From 2a788386131d7f813dd71e506050b2de956ba567 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 21 Jan 2023 22:28:41 +0100 Subject: [PATCH] Use a ScopeGuard to manage _loading_analysis properly. --- src/wx/text_panel.cc | 9 +++++---- 1 file 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 (); } -- 2.30.2