From ca0becb1dd13b47a8f1b7976dedc44466c49d0a7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 5 Dec 2022 20:50:16 +0100 Subject: Cleanup: use ScopeGuard. --- src/wx/content_panel.cc | 5 ++--- 1 file 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); } -- cgit v1.2.3