GNOME Bugzilla – Bug 646286
Passing initialized field to base constructor segfaults
Last modified: 2011-04-02 14:02:00 UTC
This might be a duplicate of (or related to) bug 567269. In Vala 0.11.7, if I initialize a member variable in its declaration and pass it to the base constructor, the program will segfault: class Foo : Object { } class Base : Object { private Foo f; public Base(Foo f) { this.f = f; } } class Child : Base { private Foo child_f = new Foo(); public Child() { // segfault here base (child_f); } } void main() { Child c = new Child(); c = null; } The segfault occurs because self is being deref'ed before being allocated in child_construct(): Child * self = NULL; self = (Child*) base_construct (object_type, self->priv->child_f);
Yes, this is exactly the same as bug 567269, implicit 'this' access is equivalent to explicit 'this' access. Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 567269 ***