From 95f79b5ce7f65c857fcb0220aba0471827026d01 Mon Sep 17 00:00:00 2001 From: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Date: Fri, 19 Aug 2011 18:12:44 -0400 Subject: [PATCH] gnome: #6623 clean calllists --- gnome/src/actions.c | 4 +++- gnome/src/contacts/calllist.c | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gnome/src/actions.c b/gnome/src/actions.c index 6f7885e56e..55a17aff3a 100644 --- a/gnome/src/actions.c +++ b/gnome/src/actions.c @@ -199,7 +199,9 @@ sflphone_quit () dbus_unregister (getpid()); dbus_clean (); - //call_list_clean(); TODO + calllist_clean (current_calls); + calllist_clean (contacts); + calllist_clean (history); //account_list_clean() gtk_main_quit (); } diff --git a/gnome/src/contacts/calllist.c b/gnome/src/contacts/calllist.c index 56e06a8d27..93e779a648 100644 --- a/gnome/src/contacts/calllist.c +++ b/gnome/src/contacts/calllist.c @@ -102,16 +102,31 @@ calllist_init (calltab_t* tab) tab->selectedCall = NULL; } +/* + * Function passed to calllist_clean to free every QueueElement. + */ +static void +calllist_free_element(gpointer data, gpointer user_data) +{ + QueueElement *element = data; + if (element->type == HIST_CONFERENCE) + free_conference_obj_t (element->elem.conf); + else /* HIST_CALL */ + free_callable_obj_t (element->elem.call); + free (element); +} + void calllist_clean (calltab_t* tab) { + g_queue_foreach (tab->callQueue, calllist_free_element, NULL); g_queue_free (tab->callQueue); } void calllist_reset (calltab_t* tab) { - g_queue_free (tab->callQueue); + calllist_clean (tab); tab->callQueue = g_queue_new(); } -- GitLab