Inconsistent behaviour of the object.connect function
Right now, depending on the context, this function might get converted to g_signal_connect_object or g_signal_connect_data. The problem is that the former function will disconnect the signal automatically whereas the latter will not. Consider the following code:
class Foo {
public signal void sig ();
}
class Test:Object{
public int data;
public void con(Foo foo){
foo.sig.connect (() => { stdout.printf ("Test %d\n",data); });
}
}
void main () {
var foo = new Foo ();
{
var test = new Test();
test.data=1;
test.con(foo);
}
{
var test = new Test();
test.data=2;
foo.sig.connect (() => { stdout.printf ("Test %d\n",test.data); });
}
foo.sig ();
}
It will print only "Test 2" and not "Test 1 Test 2", which is weird and cannot be predicted based on current documentation.