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/ardour/midi_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/ardour/midi_ui.cc')
-rw-r--r-- | libs/ardour/midi_ui.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc index 5a0640b3f6..ffcec00de7 100644 --- a/libs/ardour/midi_ui.cc +++ b/libs/ardour/midi_ui.cc @@ -64,6 +64,10 @@ MidiControlUI::do_request (MidiUIRequest* req) } else if (req->type == CallSlot) { req->the_slot (); + + } else if (req->type == Quit) { + + BaseUI::quit (); } } @@ -102,8 +106,8 @@ void MidiControlUI::clear_ports () { for (PortSources::iterator i = port_sources.begin(); i != port_sources.end(); ++i) { - /* remove existing sources from the event loop */ - (*i)->destroy (); + g_source_destroy (*i); + g_source_unref (*i); } port_sources.clear (); @@ -120,13 +124,15 @@ MidiControlUI::reset_ports () int fd; if ((fd = (*i)->selectable ()) >= 0) { Glib::RefPtr<IOSource> psrc = IOSource::create (fd, IO_IN|IO_HUP|IO_ERR); + psrc->connect (bind (mem_fun (*this, &MidiControlUI::midi_input_handler), (*i))); - port_sources.push_back (psrc); - } - } + psrc->attach (_main_loop->get_context()); - for (PortSources::iterator i = port_sources.begin(); i != port_sources.end(); ++i) { - (*i)->attach (_main_loop->get_context()); + // glibmm hack: for now, store only the GSource* + + port_sources.push_back (psrc->gobj()); + g_source_ref (psrc->gobj()); + } } } |