summaryrefslogtreecommitdiff
path: root/src/wx/controls.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-13 13:57:28 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-14 00:42:39 +0100
commitb7e65adf286ce20918797a06a910ededf8f07b7b (patch)
tree5ae7d4b521cedc75feef7b1a03b86b2e058795ad /src/wx/controls.cc
parente002d31ac51e80bb1d008c198b864dfcb2b30cb3 (diff)
Use more ScopeGuards.
Diffstat (limited to 'src/wx/controls.cc')
-rw-r--r--src/wx/controls.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wx/controls.cc b/src/wx/controls.cc
index f16b494c9..804b59dae 100644
--- a/src/wx/controls.cc
+++ b/src/wx/controls.cc
@@ -36,6 +36,7 @@
#include "lib/job.h"
#include "lib/job_manager.h"
#include "lib/player_video.h"
+#include "lib/scope_guard.h"
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/reel.h>
@@ -381,10 +382,11 @@ void
Controls::timecode_clicked ()
{
auto dialog = new PlayheadToTimecodeDialog(this, _viewer.position(), _film->video_frame_rate());
+ ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+
if (dialog->ShowModal() == wxID_OK) {
_viewer.seek(dialog->get(), true);
}
- dialog->Destroy ();
}
@@ -392,10 +394,11 @@ void
Controls::frame_number_clicked ()
{
auto dialog = new PlayheadToFrameDialog(this, _viewer.position(), _film->video_frame_rate());
+ ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+
if (dialog->ShowModal() == wxID_OK) {
_viewer.seek(dialog->get(), true);
}
- dialog->Destroy ();
}