[Evolution-hackers] freeing evolution data structures



Hi

my name is Alexander and I was searching for a command-line tool that I
could use together with mutt to query the mail addresses from the
evolution address book. I could not find such a tool so I started
writing one myself. The program itself is working but during my hunt for
memory leaks (using valgrind) a few questions arised so maybe someone
her could help me or give me an useful hint.

1:
Is there a function that frees all the data structures and the memory
that was allocated be g_type_init()?


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.


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.

Hope someone can give me a few hints.

cu
  Alexander




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