Re: [Evolution-hackers] freeing evolution data structures



On Mon, 2005-09-12 at 15:16 +0200, Alexander Dreweke wrote:
> 1:
> Is there a function that frees all the data structures and the memory
> that was allocated be g_type_init()?

No.

> 2:
> I get the ESourList for the address books by:
> 
> 	ESourceList *gconf_source_list =
> e_source_list_new_for_gconf_default("/apps/evolution/addressbook/sources");
> 
> How can I free the memory that for this ESourceList? I've tried:
> 	
> 	g_object_unref(gconf_source_list);
> 
> But this produces, the following runtime warnings:
> 
> 	GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT
> (object)' failed
> 
> So that doesn't seem to be the right way, but when I use:
> 
> 	g_free(gconf_source_list);
> 
> I still have a memory-leak.

g_object_unref is the correct method here, so this is a bug in your code
somewhere else.


> 3:
> I've got an similar problem with the following GSList:
> 
> 	GSList *groups = e_source_list_peek_groups(gconf_source_list);
> 
> When I try to free the GSList with:
> 	
> 	g_slist_foreach(groups, (GFunc) g_object_unref, NULL);
> 	g_slist_free(groups);
> 
> I get warnings that "g_object_unref: assertion `G_IS_OBJECT (object)'
> failed" like for the ESourceList and when i use g_free instead of
> g_object_unref then i still have a memory-leak.

By calling peek_groups() you don't have to free the list.

Ross
-- 
Ross Burton                                 mail: ross burtonini com
                                          jabber: ross burtonini com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF





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