[Vala] delegates + struct initializer problem



Hi!
I'm using structure with delegate field. When I assign that field with
structure initializer, then call to delegate is failed.
Am I doing something wrong or is this a bug in vala? Here is the code
demonstrating problem:

delegate void func();

class test_class : Object {

public void method() {
stdout.printf("method is called\n");
}
}

struct wrapper {
unowned func f;
}

int main(string[] args) {
var t = new test_class();
 wrapper w = { f : t.method };
*w.f(); // this call is failed with message: CRITICAL **: testclass_method:
assertion `self != NULL' failed*

wrapper w2 = { };
w2.f = t.method;
* w2.f(); // this is fine*
 return 0;
}



-- 
Sincerely,
Magomed


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]