X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Ftext_panel.cc;h=8e7d4434e7958604b10d040d91e939c36336e503;hp=7e6557ba9c88bd0d678887c12eef705b62e3417f;hb=b7e65adf286ce20918797a06a910ededf8f07b7b;hpb=e002d31ac51e80bb1d008c198b864dfcb2b30cb3 diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 7e6557ba9..8e7d4434e 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -41,6 +41,7 @@ #include "lib/ffmpeg_content.h" #include "lib/ffmpeg_subtitle_stream.h" #include "lib/job_manager.h" +#include "lib/scope_guard.h" #include "lib/string_text_file_content.h" #include "lib/string_text_file_decoder.h" #include "lib/subtitle_analysis.h" @@ -370,10 +371,10 @@ TextPanel::dcp_track_changed () if (_dcp_track->GetSelection() == int(_dcp_track->GetCount()) - 1) { auto d = new DCPTextTrackDialog (this); + ScopeGuard sg = [d]() { d->Destroy(); }; if (d->ShowModal() == wxID_OK) { track = d->get(); } - d->Destroy (); } else { /* Find the DCPTextTrack that was selected */ for (auto i: _parent->film()->closed_caption_tracks()) {