summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-19 00:03:09 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-19 00:03:09 +0100
commitbb8ddd298ed2925a94b95651534a563992f840ea (patch)
tree29439f43d62db826e7ff227d24d1836e44a65f39 /src
parent6a4a63310445bd5554f0df1b290b0c1af3f73779 (diff)
Use ScopeGuard for _no_check_selection
Diffstat (limited to 'src')
-rw-r--r--src/wx/content_panel.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index fd1315747..77607ad16 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -817,14 +817,16 @@ ContentPanel::set_selection (weak_ptr<Content> wc)
void
ContentPanel::set_selection (ContentList cl)
{
- _no_check_selection = true;
+ {
+ _no_check_selection = true;
+ ScopeGuard sg = [this]() { _no_check_selection = false; };
- auto content = _film->content ();
- for (size_t i = 0; i < content.size(); ++i) {
- set_selected_state(i, find(cl.begin(), cl.end(), content[i]) != cl.end());
+ auto content = _film->content ();
+ for (size_t i = 0; i < content.size(); ++i) {
+ set_selected_state(i, find(cl.begin(), cl.end(), content[i]) != cl.end());
+ }
}
- _no_check_selection = false;
check_selection ();
}