.disconnect() syntax is different for Vala Objects and dynamic variables
Submitted by Marcin Lewandowski
Link to original bug (#703353)
Description
In vala 0.20.1 if I have class like this:
class Test : Object { public signal void test_signal(); public dynamic Gst.Element test_element; }
I can use following syntax to bind/unbind to test_signal():
var obj = new Test(); obj.test_signal.connect(handler); obj.test_signal.disconnect(handler);
But I am unable to use the same syntax for test_element variable:
var obj = new Test(); obj.test_element.drained.connect(handler); obj.test_element.drained.disconnect(handler);
The last call expects parameter to be ulong.
Obviously it should has consistent syntax.
Right now, even passing this ulong callback ID is impossible as .connect() called on dynamic variables' signals evaluate to something like this:
void _dynamic_connection_problem3_connect (gpointer obj, const char * signal_name, GCallback handler, gpointer data);
(there's no return value)
Obviously I can manually call SignalHandler.disconnect_matched but it kills the whole point of having nice .connect()/.disconnect() signals.
It is especially important for users of GLib < 2.36 (AFAIK still shipped with most distros considered to be stable - debian wheezy, ubuntu 12.04 LTS etc.) as GLib < 2.36 contains a bug in g_signal_connect_object that is likely to cause memory leaks. (https://developer.gnome.org/gobject/2.34/gobject-Signals.html#g-signal-connect-object)
Version: 0.20.x