diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-12-05 20:44:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-12-05 20:44:42 +0100 |
| commit | 9c096947fee8eb296c4341fec6426d5b74fd3d36 (patch) | |
| tree | 76f695c45f7ed70b4f4559f0bb2f382349f39605 | |
| parent | 0fa422e8f419ba1388448fe384e4998a6b3426d4 (diff) | |
Cleanup: use ScopeGuard.
| -rw-r--r-- | src/wx/content_panel.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index bf02e3930..1a5dbdc51 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -43,6 +43,7 @@ #include "lib/image_content.h" #include "lib/log.h" #include "lib/playlist.h" +#include "lib/scope_guard.h" #include "lib/string_text_file.h" #include "lib/string_text_file_content.h" #include "lib/text_content.h" @@ -619,14 +620,13 @@ void ContentPanel::add_folder_clicked () { auto d = new wxDirDialog (_splitter, _("Choose a 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_folder(path); } |
