segfault when chaining to a lambda-taking constructor
Submitted by Ilya Mezhirov
Link to original bug (#692023)
Description
Created attachment 233772 valac bar.vala; ./bar -> Segmentation fault
$ valac --version Vala 0.18.1
This segfaults but shouldn't:
class Foo
{
int x;
public delegate int Callback();
public Foo.from_callback(Callback cb)
{
x = cb();
}
public Foo()
{
var a = new int[]{57}; // the array is magical, without it the error doesn't show up
this.from_callback(() => { return a[0]; });
}
}
void main()
{
new Foo();
}
This is compiled into:
Foo* foo_construct (GType object_type) {
Foo* self = NULL;
Block1Data* _data1_;
...
_data1_->self = foo_ref (self);
and foo_ref() segfaults.
I have to move back to 0.16 for now since some old code depends on such things.
Might be related to this bug: https://bugzilla.gnome.org/show_bug.cgi?id=692019
Attachment 233772, "valac bar.vala; ./bar -> Segmentation fault":
bar.vala
Version: 0.18.x
Edited by Rico Tzschichholz