Lazarus

Programming => Widgetset => GTK => Topic started by: Mike.Cornflake on August 06, 2011, 12:21:31 am

Title: Working with GList
Post by: Mike.Cornflake on August 06, 2011, 12:21:31 am
G'day,

I've noticed a few places in gtk2wscustomlistview.inc where we're getting a GList from the underlying GTK IconView, but we're not then free'ing this GList.  This is inconsistent throughout the unit - sometimes it's free'd simply using g_list_free(), othertimes it's not free'd at all.

Checking the GTK documentation http://developer.gnome.org/gtk/2.24/GtkIconView.html#gtk-icon-view-get-selected-items (http://developer.gnome.org/gtk/2.24/GtkIconView.html#gtk-icon-view-get-selected-items), looks like we should be calling both g_list_free, and g_list_foreach each and every time.

So, my first question is - does anyone know if we *need* to call free, or if there's some garbage collection mechanism in GTK going on?

If we do need to free the GList's after ourselves, does anyone know how to call g_list_foreach?  I've tried g_list_foreach(List, gtk_tree_path_free, nil) and g_list_foreach(List, @gtk_tree_path_free, nil) - neither compile...

My final question is the one I'm going through now...  How do I check to see if there any GTK objects leaked? 

And apologies if this is the wrong forum to post this to - not sure what the relationship between GTK and glib is, and this is really a glib question...