summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-15 01:25:27 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-15 01:25:27 +0100
commit963c7649da903b87637975e8c2d634da887d3109 (patch)
treeab59391e9f4fd5a35f4bec052b97d4e703b007cd /src/tools
parentfcaf62b405f6379e7030ddc2a38426c5f9ffb081 (diff)
Use wx_ptr for the splash screen.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc15
-rw-r--r--src/tools/dcpomatic_editor.cc2
-rw-r--r--src/tools/dcpomatic_kdm.cc2
-rw-r--r--src/tools/dcpomatic_player.cc20
4 files changed, 13 insertions, 26 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 546306ac4..af4576fd5 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -1728,10 +1728,7 @@ private:
}
catch (exception& e)
{
- if (_splash) {
- _splash->Destroy ();
- _splash = nullptr;
- }
+ _splash.reset();
error_dialog (nullptr, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
}
@@ -1843,10 +1840,7 @@ private:
void close_splash ()
{
- if (_splash) {
- _splash->Destroy ();
- _splash = nullptr;
- }
+ _splash.reset();
}
void config_failed_to_load (Config::LoadFailure what)
@@ -1864,8 +1858,7 @@ private:
/* Destroy the splash screen here, as otherwise bad things seem to happen (for reasons unknown)
when we open our recreate dialog, close it, *then* try to Destroy the splash (the Destroy fails).
*/
- _splash->Destroy ();
- _splash = nullptr;
+ _splash.reset();
auto config = Config::instance();
switch (reason) {
@@ -1934,7 +1927,7 @@ private:
}
DOMFrame* _frame = nullptr;
- wxSplashScreen* _splash = nullptr;
+ wx_ptr<wxSplashScreen> _splash;
shared_ptr<wxTimer> _timer;
string _film_to_load;
string _film_to_create;
diff --git a/src/tools/dcpomatic_editor.cc b/src/tools/dcpomatic_editor.cc
index 51135ef46..8e306551f 100644
--- a/src/tools/dcpomatic_editor.cc
+++ b/src/tools/dcpomatic_editor.cc
@@ -431,7 +431,7 @@ private:
bool OnInit () override
{
- wxSplashScreen* splash = nullptr;
+ wx_ptr<wxSplashScreen> splash;
try {
wxInitAllImageHandlers ();
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 87a77c626..673c54f78 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -770,7 +770,7 @@ private:
bool OnInit () override
{
- wxSplashScreen* splash = nullptr;
+ wx_ptr<wxSplashScreen> splash;
try {
wxInitAllImageHandlers ();
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 600d1c6b4..1808e86fe 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -898,16 +898,14 @@ private:
DCPOMATIC_ASSERT (dcp);
auto job = make_shared<VerifyDCPJob>(dcp->directories());
- auto progress = new VerifyDCPProgressDialog(this, _("DCP-o-matic Player"));
+ auto progress = make_wx<VerifyDCPProgressDialog>(this, _("DCP-o-matic Player"));
bool const completed = progress->run (job);
- progress->Destroy ();
if (!completed) {
return;
}
- auto d = new VerifyDCPDialog (this, job);
+ auto d = make_wx<VerifyDCPDialog>(this, job);
d->ShowModal ();
- d->Destroy ();
}
void tools_check_for_updates ()
@@ -918,9 +916,8 @@ private:
void tools_timing ()
{
- auto d = new TimerDisplay(this, _viewer.state_timer(), _viewer.gets());
+ auto d = make_wx<TimerDisplay>(this, _viewer.state_timer(), _viewer.gets());
d->ShowModal ();
- d->Destroy ();
}
void tools_system_information ()
@@ -934,18 +931,16 @@ private:
void help_about ()
{
- auto d = new AboutDialog (this);
+ auto d = make_wx<AboutDialog>(this);
d->ShowModal ();
- d->Destroy ();
}
void help_report_a_problem ()
{
- auto d = new ReportProblemDialog (this);
+ auto d = make_wx<ReportProblemDialog>(this);
if (d->ShowModal () == wxID_OK) {
d->report ();
}
- d->Destroy ();
}
void update_checker_state_changed ()
@@ -964,9 +959,8 @@ private:
}
if (uc->state() == UpdateChecker::State::YES) {
- auto dialog = new UpdateDialog (this, uc->stable (), uc->test ());
+ auto dialog = make_wx<UpdateDialog>(this, uc->stable (), uc->test ());
dialog->ShowModal ();
- dialog->Destroy ();
} else if (uc->state() == UpdateChecker::State::FAILED) {
error_dialog (this, _("The DCP-o-matic download server could not be contacted."));
} else {
@@ -1168,7 +1162,7 @@ private:
bool OnInit () override
{
- wxSplashScreen* splash = nullptr;
+ wx_ptr<wxSplashScreen> splash;
try {
wxInitAllImageHandlers ();