diff options
author | Robin Gareus <robin@gareus.org> | 2017-07-06 16:55:02 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-07-06 16:55:02 +0200 |
commit | d5d297c4071240d8a462fa22d53dba03cbdc211d (patch) | |
tree | 1c4905b5321987732f2db8fe04684dfb7cec25f7 /libs/surfaces/faderport8 | |
parent | 7bb48aaa3f726679b7160799bd9d874c42a895e4 (diff) |
Fix FP8 shutdown sequence (amend d421e56fc)
Diffstat (limited to 'libs/surfaces/faderport8')
-rw-r--r-- | libs/surfaces/faderport8/faderport8.cc | 26 | ||||
-rw-r--r-- | libs/surfaces/faderport8/faderport8.h | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/libs/surfaces/faderport8/faderport8.cc b/libs/surfaces/faderport8/faderport8.cc index 3ae9994792..0ffa70a0aa 100644 --- a/libs/surfaces/faderport8/faderport8.cc +++ b/libs/surfaces/faderport8/faderport8.cc @@ -147,19 +147,21 @@ FaderPort8::FaderPort8 (Session& s) FaderPort8::~FaderPort8 () { - cerr << "~FP8\n"; - disconnected (); - close (); + /* this will be called from the main UI thread. during Session::destroy(). + * There can be concurrent activity from BaseUI::main_thread -> AsyncMIDIPort + * -> MIDI::Parser::signal -> ... to any of the midi_connections + * + * stop event loop early and join thread */ + stop (); if (_input_port) { DEBUG_TRACE (DEBUG::FaderPort8, string_compose ("unregistering input port %1\n", boost::shared_ptr<ARDOUR::Port>(_input_port)->name())); - _input_port->disconnect_all (); - _input_port->drain (5000, 50000); - _input_port->clear (); AudioEngine::instance()->unregister_port (_input_port); _input_port.reset (); } + disconnected (); // zero faders, turn lights off, clear strips + if (_output_port) { _output_port->drain (10000, 250000); /* check every 10 msecs, wait up to 1/4 second for the port to drain */ DEBUG_TRACE (DEBUG::FaderPort8, string_compose ("unregistering output port %1\n", boost::shared_ptr<ARDOUR::Port>(_output_port)->name())); @@ -168,10 +170,6 @@ FaderPort8::~FaderPort8 () } tear_down_gui (); - - /* stop event loop */ - DEBUG_TRACE (DEBUG::FaderPort8, "BaseUI::quit ()\n"); - BaseUI::quit (); } /* **************************************************************************** @@ -196,13 +194,16 @@ FaderPort8::do_request (FaderPort8Request* req) call_slot (MISSING_INVALIDATOR, req->the_slot); } else if (req->type == Quit) { stop (); + disconnected (); } } -int +void FaderPort8::stop () { + DEBUG_TRACE (DEBUG::FaderPort8, "BaseUI::quit ()\n"); BaseUI::quit (); + close (); // drop references, disconnect from session signals return 0; } @@ -277,8 +278,7 @@ FaderPort8::set_active (bool yn) BaseUI::run (); connect_session_signals (); } else { - BaseUI::quit (); - close (); + stop (); } ControlProtocol::set_active (yn); diff --git a/libs/surfaces/faderport8/faderport8.h b/libs/surfaces/faderport8/faderport8.h index 9b11fea6b4..c3c62735eb 100644 --- a/libs/surfaces/faderport8/faderport8.h +++ b/libs/surfaces/faderport8/faderport8.h @@ -99,7 +99,7 @@ public: bool twolinetext () const { return _two_line_text; } bool auto_pluginui () const { return _auto_pluginui; } - int stop (); + void stop (); void do_request (FaderPort8Request*); void thread_init (); |