Add wx_ptr and use it instead of ScopeGuard in a lot of places.
[dcpomatic.git] / src / wx / text_panel.cc
index 8e7d4434e7958604b10d040d91e939c36336e503..94ec8506d65366395a12d592cf0960f6d5b771cc 100644 (file)
@@ -32,6 +32,7 @@
 #include "subtitle_appearance_dialog.h"
 #include "text_panel.h"
 #include "text_view.h"
+#include "wx_ptr.h"
 #include "wx_util.h"
 #include "lib/analyse_subtitles_job.h"
 #include "lib/dcp_content.h"
@@ -370,8 +371,7 @@ TextPanel::dcp_track_changed ()
        optional<DCPTextTrack> track;
 
        if (_dcp_track->GetSelection() == int(_dcp_track->GetCount()) - 1) {
-               auto d = new DCPTextTrackDialog (this);
-               ScopeGuard sg = [d]() { d->Destroy(); };
+               auto d = make_wx<DCPTextTrackDialog>(this);
                if (d->ShowModal() == wxID_OK) {
                        track = d->get();
                }