summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-02-25 01:53:48 +0100
committerCarl Hetherington <cth@carlh.net>2025-02-25 13:04:08 +0100
commit6d3086dd78a35bdc179a6579e23f8b5816347dbf (patch)
treea47facfec259302afd6e0e690b748ad9f655548e /src/tools
parent91c171b65e7329b90ac77442fd35b165bde70b26 (diff)
Fix misunderstanding of wxDialog lifetime handling.
Broken by d0308d53dd9f4d036d8c5fe8023920fcdfd43f39 wxDialog can be stack allocated if opened with ShowModal(), but not with Show(). Go back to wx_ptr for those that are opened with Show().
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc16
-rw-r--r--src/tools/dcpomatic_player.cc5
2 files changed, 11 insertions, 10 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 7048781e3..3d9d571af 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -876,7 +876,7 @@ private:
return;
}
- _kdm_dialog.emplace(this, _film);
+ _kdm_dialog.reset(this, _film);
_kdm_dialog->Show ();
}
@@ -886,7 +886,7 @@ private:
return;
}
- _dkdm_dialog.emplace(this, _film);
+ _dkdm_dialog.reset(this, _film);
_dkdm_dialog->Show ();
}
@@ -1083,7 +1083,7 @@ private:
void view_video_waveform ()
{
if (!_video_waveform_dialog) {
- _video_waveform_dialog.emplace(this, _film, _film_viewer);
+ _video_waveform_dialog.reset(this, _film, _film_viewer);
}
_video_waveform_dialog->Show ();
@@ -1130,7 +1130,7 @@ private:
void tools_manage_templates ()
{
if (!_templates_dialog) {
- _templates_dialog.emplace(this);
+ _templates_dialog.reset(this);
}
_templates_dialog->Show ();
@@ -1578,15 +1578,15 @@ private:
wxPanel* _right_panel;
FilmViewer _film_viewer;
StandardControls* _controls;
- boost::optional<VideoWaveformDialog> _video_waveform_dialog;
+ wx_ptr<VideoWaveformDialog> _video_waveform_dialog;
SystemInformationDialog* _system_information_dialog = nullptr;
DCPReferencingDialog* _dcp_referencing_dialog = nullptr;
HintsDialog* _hints_dialog = nullptr;
ServersListDialog* _servers_list_dialog = nullptr;
wxPreferencesEditor* _config_dialog = nullptr;
- boost::optional<KDMDialog> _kdm_dialog;
- boost::optional<DKDMDialog> _dkdm_dialog;
- boost::optional<TemplatesDialog> _templates_dialog;
+ wx_ptr<KDMDialog> _kdm_dialog;
+ wx_ptr<DKDMDialog> _dkdm_dialog;
+ wx_ptr<TemplatesDialog> _templates_dialog;
wxMenu* _file_menu = nullptr;
shared_ptr<Film> _film;
int _history_items = 0;
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index b0a791633..c5242c310 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -33,6 +33,7 @@
#include "wx/timer_display.h"
#include "wx/update_dialog.h"
#include "wx/verify_dcp_dialog.h"
+#include "wx/wx_ptr.h"
#include "wx/wx_signal_manager.h"
#include "wx/wx_util.h"
#include "wx/wx_variant.h"
@@ -1014,7 +1015,7 @@ private:
void tools_system_information ()
{
if (!_system_information_dialog) {
- _system_information_dialog.emplace(this, _viewer);
+ _system_information_dialog.reset(this, _viewer);
}
_system_information_dialog->Show ();
@@ -1234,7 +1235,7 @@ private:
wxMenuItem* _history_separator = nullptr;
FilmViewer _viewer;
Controls* _controls;
- boost::optional<SystemInformationDialog> _system_information_dialog;
+ wx_ptr<SystemInformationDialog> _system_information_dialog;
std::shared_ptr<Film> _film;
boost::signals2::scoped_connection _config_changed_connection;
boost::signals2::scoped_connection _examine_job_connection;