temporarily ignore AudioEngine::Halted when GUI asks to disconnect from JACK, to...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 9 Aug 2013 02:28:31 +0000 (22:28 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 9 Aug 2013 02:28:31 +0000 (22:28 -0400)
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h

index 00767b7988b565f56ae0ec972424b71cae5e7956..3c2ed85276ca3750df7812a7955eadaa809614f9 100644 (file)
@@ -398,7 +398,7 @@ ARDOUR_UI::attach_to_engine ()
        engine->Running.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_running, this), gui_context());
        engine->SampleRateChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_sample_rate, this, _1), gui_context());
 
-       engine->Halted.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
+       engine->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
 
        ARDOUR::Port::set_connecting_blocked (ARDOUR_COMMAND_LINE::no_connect_ports);
 
@@ -1019,6 +1019,7 @@ If you still wish to quit, please use the\n\n\
                _session = 0;
        }
 
+       halt_connection.disconnect ();
        engine->stop ();
        quit ();
 }
@@ -3822,9 +3823,16 @@ void
 ARDOUR_UI::disconnect_from_jack ()
 {
        if (engine) {
+               /* drop connection to AudioEngine::Halted so that we don't act
+                *  as if the engine unexpectedly shut down
+                */
+               halt_connection.disconnect ();
+
                if (engine->stop ()) {
                        MessageDialog msg (*editor, _("Could not disconnect from JACK"));
                        msg.run ();
+               } else {
+                       engine->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
                }
 
                update_sample_rate (0);
index e784b5a9941728d4af359f3242af7c66d5896e4e..f8b47bd3e8fb1fed9c79ef2a8fe7ae7b6b3537b0 100644 (file)
@@ -711,6 +711,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void loading_message (const std::string& msg);
 
        PBD::ScopedConnectionList forever_connections;
+        PBD::ScopedConnection halt_connection; 
 
         void step_edit_status_change (bool);