summaryrefslogtreecommitdiff
path: root/src/tools/dcpomatic_server.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-02-23 01:24:17 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-23 01:24:17 +0100
commitb5700cf59c12164b07550d8b217b98b1616227ab (patch)
tree125ada25885e9f54c1e243348adb6fe2bb78e1d7 /src/tools/dcpomatic_server.cc
parentd3a3b8988fcc7df405b8d73a0aabd967ad7a8bf0 (diff)
Be more careful to always close the splash screen when necessary.
Trying to prevent error dialogues appearing behind it.
Diffstat (limited to 'src/tools/dcpomatic_server.cc')
-rw-r--r--src/tools/dcpomatic_server.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc
index 4039a07ed..185788b98 100644
--- a/src/tools/dcpomatic_server.cc
+++ b/src/tools/dcpomatic_server.cc
@@ -255,12 +255,6 @@ private:
class App : public wxApp, public ExceptionStore
{
-public:
- App ()
- : wxApp ()
- , _icon (0)
- {}
-
private:
bool OnInit ()
@@ -278,7 +272,7 @@ private:
Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
- wxSplashScreen* splash = maybe_show_splash ();
+ _splash = maybe_show_splash ();
dcpomatic_setup_path_encoding ();
dcpomatic_setup_i18n ();
@@ -307,9 +301,7 @@ private:
_timer.reset (new wxTimer (this));
_timer->Start (1000);
- if (splash) {
- splash->Destroy ();
- }
+ close_splash ();
SetExitOnFrameDelete (false);
@@ -348,19 +340,30 @@ private:
signal_manager->ui_idle ();
}
+ void close_splash ()
+ {
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = 0;
+ }
+ }
+
void config_failed_to_load ()
{
+ close_splash ();
message_dialog (0, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
}
void config_warning (string m)
{
+ close_splash ();
message_dialog (0, std_to_wx (m));
}
boost::thread _thread;
- TaskBarIcon* _icon;
+ TaskBarIcon* _icon = nullptr;
shared_ptr<wxTimer> _timer;
+ wxSplashScreen* _splash = nullptr;
};
IMPLEMENT_APP (App)