Author Topic: Working with GList  (Read 5032 times)


  • Hero Member
  • *****
  • Posts: 1256
Working with GList
« on: August 06, 2011, 12:21:31 am »

I've noticed a few places in 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, 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...
« Last Edit: August 06, 2011, 12:33:41 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:
  BOOKS! (Free and otherwise):


TinyPortal © 2005-2018