Patch: Fix ref leak in folder list store get_parent_full_name



	Hi,

	This patch avoids a reference leak on obtaining the parent full name.

Changelog entry:
* libtinymailui-gtk/tny-gtk-folder-list-store.c (get_parent_full_name):
  there was a reference leak in this method, as the recursion for
  getting the list of all parents was not properly freeing the
  objects.

-- 
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/ChangeLog b/ChangeLog
index 9f9cddf..e1f2fa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-20  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymailui-gtk/tny-gtk-folder-list-store.c (get_parent_full_name):
+	there was a reference leak in this method, as the recursion for
+	getting the list of all parents was not properly freeing the
+	objects.
+
 2009-07-16  Sergio Villar Senin  <svillar igalia com>
 
 	* libtinymail-camel/tny-camel-folder.c (folder_tracking_changed):
diff --git a/libtinymailui-gtk/tny-gtk-folder-list-store.c b/libtinymailui-gtk/tny-gtk-folder-list-store.c
index c963ccf..da5c660 100644
--- a/libtinymailui-gtk/tny-gtk-folder-list-store.c
+++ b/libtinymailui-gtk/tny-gtk-folder-list-store.c
@@ -184,15 +184,17 @@ get_parent_full_name (TnyFolderStore *store, gchar *path_separator)
 	gchar *name = NULL;
 
 	folders = tny_simple_list_new ();
-	current = store;
+	current = g_object_ref (store);
 
 	while (current && !TNY_IS_ACCOUNT (current)) {
+		TnyFolderStore *to_unref;
+		to_unref = current;
 		tny_list_prepend (folders, (GObject *) current);
 		current = tny_folder_get_folder_store (TNY_FOLDER (current));
+		g_object_unref (to_unref);
 	}
 
-	if (current && (current != store))
-		g_object_unref (current);
+	g_object_unref (current);
 
 	iter = tny_list_create_iterator (folders);
 	while (!tny_iterator_is_done (iter)) {


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