X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_kdm.cc;h=256367977e988a67112b455936564cc00bd7e60a;hp=04b37b2c6bb1005b5c3fb03c1a1e3947c7dca71f;hb=b7e65adf286ce20918797a06a910ededf8f07b7b;hpb=e002d31ac51e80bb1d008c198b864dfcb2b30cb3 diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 04b37b2c6..256367977 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -267,17 +267,17 @@ private: void help_about () { auto d = new AboutDialog (this); + ScopeGuard sg = [d]() { d->Destroy(); }; d->ShowModal (); - d->Destroy (); } void help_report_a_problem () { auto d = new ReportProblemDialog (this, shared_ptr()); + ScopeGuard sg = [d]() { d->Destroy(); }; if (d->ShowModal () == wxID_OK) { d->report (); } - d->Destroy (); } void setup_menu (wxMenuBar* m) @@ -567,16 +567,18 @@ private: void add_dkdm_folder_clicked () { auto d = new NewDKDMFolderDialog (this); - if (d->ShowModal() == wxID_OK) { - auto new_dkdm = make_shared(wx_to_std(d->get())); - auto parent = dynamic_pointer_cast(selected_dkdm()); - if (!parent) { - parent = Config::instance()->dkdms (); - } - add_dkdm(new_dkdm, parent); - update_dkdm_view(); + ScopeGuard sg = [d]() { d->Destroy(); }; + if (d->ShowModal() != wxID_OK) { + return; } - d->Destroy (); + + auto new_dkdm = make_shared(wx_to_std(d->get())); + auto parent = dynamic_pointer_cast(selected_dkdm()); + if (!parent) { + parent = Config::instance()->dkdms (); + } + add_dkdm(new_dkdm, parent); + update_dkdm_view(); } void update_dkdm_view() @@ -720,11 +722,11 @@ private: this, _("Select DKDM File"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + ScopeGuard sg = [d]() { d->Destroy(); }; if (d->ShowModal() == wxID_OK) { dkdm->dkdm().as_xml(wx_to_std(d->GetPath())); } - d->Destroy (); } void dkdm_search_changed()