[evolution/gnome-2-32] Bug #633854 - [templates] Crash in build_template_menus_recurse



commit 197635633a52222943e3eecd39944b7aa4733bd1
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 6 15:54:21 2011 +0100

    Bug #633854 - [templates] Crash in build_template_menus_recurse

 plugins/templates/templates.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 483d940..1ad286d 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -565,9 +565,9 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 		gchar *path;
 		guint ii;
 
+		folder_name = folder_info->name;
 		folder = camel_store_get_folder (
 			store, folder_info->full_name, 0, NULL);
-		folder_name = camel_folder_get_name (folder);
 
 		action_name = g_strdup_printf (
 			"templates-menu-%d", *action_count);
@@ -600,9 +600,15 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 				path, action_count, merge_id,
 				folder_info->child, message_folder, message_uid);
 
+		if (!folder) {
+			g_free (path);
+			folder_info = folder_info->next;
+			continue;
+		}
+
 		/* Get the UIDs for this folder and add them to the menu. */
 		uids = camel_folder_get_uids (folder);
-		for (ii = 0; ii < uids->len; ii++) {
+		for (ii = 0; uids && ii < uids->len; ii++) {
 			CamelMimeMessage *template;
 			const gchar *uid = uids->pdata[ii], *muid;
 			guint32 flags;
@@ -656,8 +662,9 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 			g_object_unref (action);
 			g_free (action_name);
 		}
-		camel_folder_free_uids (folder, uids);
 
+		camel_folder_free_uids (folder, uids);
+		g_object_unref (folder);
 		g_free (path);
 
 		folder_info = folder_info->next;



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