- for (PortSources::iterator i = port_sources.begin(); i != port_sources.end(); ++i) {
- (*i)->attach (_main_loop->get_context());
+ psrc->connect (sigc::bind (sigc::mem_fun (this, &MidiControlUI::midi_input_handler), *i));
+ 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());
+ }