Hi:

For example,
Clutter.Color bg;
Clutter.Actor rect = new Clutter.Rectangle();
rect.get("background-color", out bg);

Since GObject.get() will return a copied Clutter.Color, the second
parameter must be a pointer to a Clutter.Color pointer (ClutterColor **).
But since you actually pass in a Clutter.Color pointer (ClutterColor *),
what you got is address filled in first 4 bytes of bg and memory leak, in
this example.

I tried this way
Clutter.Color * bg;
Clutter.Actor rect = new Clutter.Rectangle();
rect.get("background-color", out bg);

bg will point to returned Clutter.Color, but I don't know the right way to
free it. In clutter-1.0.vapi, Clutter.Color has free() method, I can invoke
it like
bg->free();

But Vala code generator will copy it into another Clutter.Color (just like
another primitive types) which is on the stack and pass it to the
Clutter.Color.free(), eg.
ClutterColor * tmp5;
tmp5 = * bg;
clutter_color_free(& tmp5);

This causes glibc dumpping and aborting our process. I also tried free with
delete keyword, but with no luck, the generated C code simple free with
g_free()
g_free(bg);

Derek Dai


On Fri, Sep 14, 2012 at 8:00 PM, <[email protected]> wrote:

> eed to do
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to