Hello,
I have just discovered a strange bug in Vala 0.44.3
Consider the code bellow:
using GLib;
public class ABC : GLib.Object {
public static int main (string[] args) {
Object a = new Object (typeof (ABC));
assert (a.get_type () == typeof (ABC));
return 0;
}
}
The code looks valid and compiles, but it does not run.
You will get the following error:
(process:9209): GLib-GObject-CRITICAL **: 23:15:21.563: g_object_new_is_valid_property: object class 'GObject' has no property named '\u0001'
So I did some digging and found that the code gen is doing something very wrong, as this is the generated C code:
gint
abc_main (gchar** args,
gint args_length1)
{
gint result = 0;
GObject* a = NULL;
GObject* _tmp0_;
#line 6 "../test.vala"
_tmp0_ = g_object_new (G_TYPE_OBJECT, TYPE_ABC, NULL);
#line 6 "../test.vala"
a = _tmp0_;
#line 8 "../test.vala"
_vala_assert (G_TYPE_FROM_INSTANCE (a) == TYPE_ABC, "a.get_type () == typeof (ABC)");
#line 10 "../test.vala"
result = 0;
#line 10 "../test.vala"
_g_object_unref0 (a);
#line 10 "../test.vala"
return result;
#line 67 "test.c"
}
As you can see the g_object_new (...)
is incorrect.
Or is this the new behaviour for this? How do you set construct-only properties if you can’t do it this way?
Regards
Gustav Hartvigsson