This was necessary due to a bug/design issue between Glibmm and Glib (see https://bugzilla.gnome.org/show_bug.cgi?id=561885)
but the problem needs to be managed by the *creator* of the IOSource and that has now moved inside CrossThreadChannel.
void do_request (MidiUIRequest*);
private:
- typedef std::list<GSource*> PortSources;
- PortSources port_sources;
ARDOUR::Session& _session;
bool midi_input_handler (Glib::IOCondition, AsyncMIDIPort*);
void
MidiControlUI::clear_ports ()
{
- for (PortSources::iterator i = port_sources.begin(); i != port_sources.end(); ++i) {
- g_source_destroy (*i);
- g_source_unref (*i);
- }
-
- port_sources.clear ();
}
void
MidiControlUI::reset_ports ()
{
- if (!port_sources.empty()) {
- return;
- }
-
vector<AsyncMIDIPort*> ports;
AsyncMIDIPort* p;
if (psrc) {
psrc->connect (sigc::bind (sigc::mem_fun (this, &MidiControlUI::midi_input_handler), *pi));
psrc->attach (_main_loop->get_context());
-
- // glibmm hack: for now, store only the GSource*
-
- port_sources.push_back (psrc->gobj());
- g_source_ref (psrc->gobj());
}
}
}
psrc->connect (sigc::bind (sigc::mem_fun (this, &MackieControlProtocol::midi_input_handler), &input_port));
psrc->attach (main_loop()->get_context());
-
- // glibmm hack: for now, store only the GSource*
-
- port_sources.push_back (psrc->gobj());
- g_source_ref (psrc->gobj());
} else {
_input_bundle->remove_channels ();
_output_bundle->remove_channels ();
}
-
- for (PortSources::iterator i = port_sources.begin(); i != port_sources.end(); ++i) {
- g_source_destroy (*i);
- g_source_unref (*i);
- }
-
- port_sources.clear ();
}
void
};
typedef std::map<Mackie::Button::ID,ButtonHandlers> ButtonMap;
- typedef std::list<GSource*> PortSources;
static MackieControlProtocol* _instance;
ViewMode _view_mode;
int _current_selected_track;
int _modifier_state;
- PortSources port_sources;
ButtonMap button_map;
int16_t _ipmidi_base;
bool needs_ipmidi_restart;