projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6a4a633
)
Use ScopeGuard for _no_check_selection
author
Carl Hetherington
<cth@carlh.net>
Wed, 18 Jan 2023 23:03:09 +0000
(
00:03
+0100)
committer
Carl Hetherington
<cth@carlh.net>
Wed, 18 Jan 2023 23:03:09 +0000
(
00:03
+0100)
src/wx/content_panel.cc
patch
|
blob
|
history
diff --git
a/src/wx/content_panel.cc
b/src/wx/content_panel.cc
index fd13157474a391c55e56e3a8d59ab5cf25ec56cd..77607ad16cb39ca01eb35c62f7b68e85f250c8cb 100644
(file)
--- 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)
{
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 ();
}
check_selection ();
}