Re: [Vala] g_object_unref: assertion `G_IS_OBJECT (object)' failed



On 12/12/2012 03:54 PM, raum no-log org wrote:
Hello,

Could you have a look to this code :
http://pastebin.com/cscSFCEP

My file name is template5.vala (yes, I've tried 4 times but without any
success :p)
---------------------------
# valac --pkg gee-1.0 template5.vala
# template5
adding test2
size: 1
++--> (null)

(template5.exe:4756): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed

---------------------------

The main function have this code :
cObject o1 = new cObject("test1");
o1.add(new cObject("test2")); // I've written "name" variable in add
method, so it shows "adding test2"... ooook

stdout.printf ("size : %d\n", o1.size); // it prints "size: 1" so object
"test2" has been added to o1... I think...

cObject o2 = o1.get(0);
stdout.printf ("++--> %s\n", o2.name); // it shows "null" and the
assertion error

Thanks

Regards

Raum
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
This is a bug in vala, see https://bugzilla.gnome.org/show_bug.cgi?id=597488

The workaround is to initialize your ArrayList in the constructor:

public cAbstractObject () {
    _objects = new ArrayList<G> ();
}



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