summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-12-05 20:50:16 +0100
committerCarl Hetherington <cth@carlh.net>2022-12-05 20:50:16 +0100
commitca0becb1dd13b47a8f1b7976dedc44466c49d0a7 (patch)
tree1f51d4b360e876744900f798a76a5fd46a414b64
parent84107d835469974b514d6cab702a770e11a9cd75 (diff)
Cleanup: use ScopeGuard.
-rw-r--r--src/wx/content_panel.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index b2b9f04c6..3dde85b43 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -674,14 +674,13 @@ void
ContentPanel::add_dcp_clicked ()
{
auto d = new wxDirDialog (_splitter, _("Choose a DCP folder"), wxT(""), wxDD_DIR_MUST_EXIST);
+ ScopeGuard sg = [d]() { d->Destroy(); };
int r = d->ShowModal ();
- boost::filesystem::path const path (wx_to_std (d->GetPath ()));
- d->Destroy ();
-
if (r != wxID_OK) {
return;
}
+ boost::filesystem::path const path(wx_to_std(d->GetPath()));
add_dcp(path);
}