diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-09 18:37:06 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-09 18:37:06 +0000 |
commit | b8b55ef0036bbef9a2961f03f44387ea8c89456a (patch) | |
tree | 47bead791023bd5efab6306ebcfea101f48688a7 /libs/pbd/base_ui.cc | |
parent | c38e02285fda1fd7966c9e4ad85994445247e6a6 (diff) |
OSC is now driven by an event loop; fix up lifetime mgmt of Glib::Source to workaround bug in Glib
git-svn-id: svn://localhost/ardour2/branches/3.0@6329 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/base_ui.cc')
-rw-r--r-- | libs/pbd/base_ui.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc index 259a51d954..9b461fb01d 100644 --- a/libs/pbd/base_ui.cc +++ b/libs/pbd/base_ui.cc @@ -37,11 +37,14 @@ using namespace Glib; uint64_t BaseUI::rt_bit = 1; BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type(); +BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type(); BaseUI::BaseUI (const string& str) : run_loop_thread (0) , _name (str) { + cerr << "New BUI called " << _name << " @ " << this << endl; + base_ui_instance = this; request_channel.ios()->connect (sigc::mem_fun (*this, &BaseUI::request_handler)); @@ -77,19 +80,24 @@ void BaseUI::run () { /* to be called by UI's that need/want their own distinct, self-created event loop thread. - Derived classes should have set up a handler for IO on request_channel.ios() */ _main_loop = MainLoop::create (MainContext::create()); request_channel.ios()->attach (_main_loop->get_context()); + + /* glibmm hack - drop the refptr to the IOSource now before it can hurt */ + request_channel.drop_ios (); + run_loop_thread = Thread::create (mem_fun (*this, &BaseUI::main_thread), true); } void BaseUI::quit () { - _main_loop->quit (); - run_loop_thread->join (); + if (_main_loop->is_running()) { + _main_loop->quit (); + run_loop_thread->join (); + } } bool |