summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-14 22:50:14 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-14 22:50:14 +0100
commit732ce79ef10c58c129a8b9822fad9955a97a153d (patch)
tree1fab563ca03ca2be09ea9cf8126a0ce1625b6e49 /src
parente6725d6b0fc1a00fbcf35c1dda2c670f349f6a36 (diff)
Use wx_ptr for AutoCropDialog
Diffstat (limited to 'src')
-rw-r--r--src/wx/auto_crop_dialog.h7
-rw-r--r--src/wx/content_menu.cc6
-rw-r--r--src/wx/content_menu.h5
3 files changed, 11 insertions, 7 deletions
diff --git a/src/wx/auto_crop_dialog.h b/src/wx/auto_crop_dialog.h
index 6c02acbdd..4ccd681ed 100644
--- a/src/wx/auto_crop_dialog.h
+++ b/src/wx/auto_crop_dialog.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_AUTO_CROP_DIALOG_H
+#define DCPOMATIC_AUTO_CROP_DIALOG_H
+
+
#include "table_dialog.h"
#include "lib/crop.h"
#include <boost/signals2.hpp>
@@ -45,3 +49,6 @@ private:
SpinCtrl* _threshold;
};
+
+#endif
+
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc
index ac7a2b58b..83b84f594 100644
--- a/src/wx/content_menu.cc
+++ b/src/wx/content_menu.cc
@@ -545,11 +545,7 @@ ContentMenu::auto_crop ()
auto const crop = guess_crop_for_content ();
update_viewer (crop);
- if (_auto_crop_dialog) {
- _auto_crop_dialog->Destroy();
- _auto_crop_dialog = nullptr;
- }
- _auto_crop_dialog = new AutoCropDialog (_parent, crop);
+ _auto_crop_dialog.reset(_parent, crop);
_auto_crop_dialog->Show ();
/* Update the dialog and view when the crop threshold changes */
diff --git a/src/wx/content_menu.h b/src/wx/content_menu.h
index 783a5be04..c750ae852 100644
--- a/src/wx/content_menu.h
+++ b/src/wx/content_menu.h
@@ -23,7 +23,9 @@
#define DCPOMATIC_CONTENT_MENU_H
+#include "auto_crop_dialog.h"
#include "timeline_content_view.h"
+#include "wx_ptr.h"
#include "lib/types.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
@@ -32,7 +34,6 @@ LIBDCP_ENABLE_WARNINGS
#include <memory>
-class AutoCropDialog;
class DCPContent;
class Film;
class FilmViewer;
@@ -85,7 +86,7 @@ private:
wxMenuItem* _set_dcp_settings;
wxMenuItem* _remove;
- AutoCropDialog* _auto_crop_dialog = nullptr;
+ wx_ptr<AutoCropDialog> _auto_crop_dialog;
boost::signals2::scoped_connection _auto_crop_config_connection;
boost::signals2::scoped_connection _auto_crop_viewer_connection;
};