summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-21 22:28:41 +0100
committerCarl Hetherington <cth@carlh.net>2023-02-27 14:47:25 +0100
commit2a788386131d7f813dd71e506050b2de956ba567 (patch)
tree096d40a9d068a66617e003b542fceb61c3f220bc
parent41467ebb0c8f1eef514b49be5fc9a042aa43cb8b (diff)
Use a ScopeGuard to manage _loading_analysis properly.
-rw-r--r--src/wx/text_panel.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index 630ca6944..1d2c86631 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -809,13 +809,16 @@ TextPanel::try_to_load_analysis ()
}
_loading_analysis = true;
+ ScopeGuard sg = [this]() {
+ _loading_analysis = false;
+ setup_sensitivity();
+ };
+
setup_sensitivity ();
_analysis.reset ();
auto content = _analysis_content.lock ();
if (!content) {
- _loading_analysis = false;
- setup_sensitivity ();
return;
}
@@ -845,8 +848,6 @@ TextPanel::try_to_load_analysis ()
}
update_outline_subtitles_in_viewer ();
- _loading_analysis = false;
- setup_sensitivity ();
}