Re: [Vala] GLib.SList as a property



Just:

public SList<string> labels { get{return h_labels;} set{h_labels = value;} }

On Tue, Jul 7, 2009 at 12:44 AM, Yu Feng<rainwoodman gmail com> wrote:

On Mon, 2009-07-06 at 13:08 -0300, Lucas Hermann Negri wrote:
I didn't added anything to the list. Just created and destroyed the
class that had this property, and it leaked.

How could it be? Could you post the code? I am confused.

Yu

On Mon, Jul 6, 2009 at 3:28 AM, Yu Feng<rainwoodman gmail com> wrote:
On Sun, 2009-07-05 at 00:55 -0300, Lucas Hermann Negri wrote:
Hello,

I have a property of GLib.SList type, defined this way:

"
public SList<string> labels { get{return h_labels;} set{h_labels = value;} }
"

But this leaks memory. What's the correct way of doing this?
I don't think SList<string> itself comes with a leak: the list is
properly destructed, so are the members. The leak does occur when one
removes an element from the list -- in other words there won't be a leak
if you merely use the list to hold the references and never remove
anything from it.


Also, how do I create a property of type string[]? I tried this way:

"
public string[] test { get; set; }
"

But the generated C code doesn't compiles.

Another issue:

I'm using a PangoLayout created using
Pango.cairo_create_layout(plot.cr), but I need to call unref() by hand
in the destructor. This is the correct behavior or just a bug in the
binding (other objects are managed automatically) ?


Thanks for the attention.











-- 
http://oproj.tuxfamily.org



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