Pop splash on dialog response - not d'tor.
authorRobin Gareus <robin@gareus.org>
Sat, 1 Apr 2017 14:40:07 +0000 (16:40 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 1 Apr 2017 14:40:07 +0000 (16:40 +0200)
A Dialog Window may not be tightly scoped, and may be around
for a while (query settings from the dialog instance). The destructor
may only be called  later.

gtk2_ardour/ardour_dialog.cc
gtk2_ardour/ardour_dialog.h
gtk2_ardour/engine_dialog.cc

index 99722d426fcd518563bba4d1409400d71622e837..0287d8c48b3b88f1c4e24b826dc0d7604782e638 100644 (file)
@@ -52,6 +52,22 @@ ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool
 }
 
 ArdourDialog::~ArdourDialog ()
+{
+       pop_splash ();
+       Keyboard::the_keyboard().focus_out_window (0, this);
+       WM::Manager::instance().remove (proxy);
+}
+
+void
+ArdourDialog::on_response (int response_id)
+{
+       pop_splash ();
+       hide ();
+       Gtk::Dialog::on_response (response_id);
+}
+
+void
+ArdourDialog::pop_splash ()
 {
        if (_splash_pushed) {
                Splash* spl = Splash::instance();
@@ -59,9 +75,8 @@ ArdourDialog::~ArdourDialog ()
                if (spl) {
                        spl->pop_front();
                }
+               _splash_pushed = false;
        }
-       Keyboard::the_keyboard().focus_out_window (0, this);
-       WM::Manager::instance().remove (proxy);
 }
 
 bool
index 3c1b869e73473de095513775d523c2f302fcbcea..c65eaa5a098dbeaba8778de644aacab253e9abf8 100644 (file)
@@ -47,11 +47,13 @@ public:
        bool on_delete_event (GdkEventAny*);
        void on_unmap ();
        void on_show ();
+       void on_response (int);
 
 private:
        WM::ProxyTemporary* proxy;
        bool _splash_pushed;
        void init ();
+       void pop_splash ();
 
        static sigc::signal<void> CloseAllDialogs;
 };
index 8b93cbf799eefd3b8fbfbce90ad8476d6e80a4c0..1a836f919c5962a657400966185cb24cff3662de 100644 (file)
@@ -417,9 +417,6 @@ void
 EngineControl::on_show ()
 {
        ArdourDialog::on_show ();
-       if (Splash::instance()) {
-               Splash::instance()->hide ();
-       }
        if (!ARDOUR::AudioEngine::instance()->current_backend() || !ARDOUR::AudioEngine::instance()->running()) {
                // re-check _have_control (jackd running) see #6041
                backend_changed ();
@@ -2736,9 +2733,6 @@ EngineControl::start_stop_button_clicked ()
                start_engine ();
                if (!ARDOUR_UI::instance()->session_loaded) {
                        ArdourDialog::on_response (RESPONSE_OK);
-                       if (Splash::instance()) {
-                               Splash::instance()->pop_front ();
-                       }
                }
        }
 }
@@ -3152,9 +3146,6 @@ EngineControl::connect_disconnect_click()
                start_engine ();
                if (!ARDOUR_UI::instance()->session_loaded) {
                        ArdourDialog::on_response (RESPONSE_OK);
-                       if (Splash::instance()) {
-                               Splash::instance()->pop_front ();
-                       }
                }
        }
 }