[evolution-data-server/gnome-2-28] Bug #574940 - Crash in message_info_to_db()



commit 9d6e999308faf9729f06a41c2c44bbc0549655a8
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 23 19:55:36 2009 +0100

    Bug #574940 - Crash in message_info_to_db()

 camel/camel-vee-folder.c  |   15 +++++++++++++--
 camel/camel-vee-summary.c |    5 ++---
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index c34038c..4a9e6c2 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -46,6 +46,7 @@
 #include "camel-vee-summary.h"
 #include "camel-string-utils.h"
 #include "camel-vee-folder.h"
+#include "camel-vtrash-folder.h"
 
 #define d(x)
 #define dd(x) (camel_debug("vfolder")?(x):0)
@@ -1113,8 +1114,12 @@ vee_rebuild_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException *ex)
 
 	camel_vee_folder_hash_folder(source, u.hash);
 	shash = g_strdup_printf("%c%c%c%c%c%c%c%c", u.hash[0], u.hash[1], u.hash[2], u.hash[3], u.hash[4], u.hash[5], u.hash[6], u.hash[7]);
-	if (!g_hash_table_lookup (vf->hashes, shash))
+	if (!g_hash_table_lookup (vf->hashes, shash)) {
 		g_hash_table_insert (vf->hashes, g_strdup(shash), source->summary);
+	}
+	if (folder_unmatched && !g_hash_table_lookup (folder_unmatched->hashes, shash)) {
+		g_hash_table_insert (folder_unmatched->hashes, g_strdup (shash), source->summary);
+	}
 
 	/* if we have no expression, or its been cleared, then act as if no matches */
 	if (vf->expression == NULL) {
@@ -1938,12 +1943,18 @@ static void
 vee_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
 {
 	gchar *shash, hash[8];
+	CamelVeeFolder *folder_unmatched = vf->parent_vee_store ? vf->parent_vee_store->folder_unmatched : NULL;
 
 	camel_vee_folder_hash_folder(sub, hash);
 	vee_folder_remove_folder(vf, sub);
 	shash = g_strdup_printf("%c%c%c%c%c%c%c%c", hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7]);
-	if (g_hash_table_lookup (vf->hashes, shash))
+	if (g_hash_table_lookup (vf->hashes, shash)) {
 		g_hash_table_remove (vf->hashes, shash);
+	}
+
+	if (folder_unmatched && g_hash_table_lookup (folder_unmatched->hashes, shash)) {
+		g_hash_table_remove (folder_unmatched->hashes, shash);
+	}
 
 	g_free(shash);
 
diff --git a/camel/camel-vee-summary.c b/camel/camel-vee-summary.c
index 42962a5..f9e5390 100644
--- a/camel/camel-vee-summary.c
+++ b/camel/camel-vee-summary.c
@@ -342,14 +342,12 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
 	/* FIXME[disk-summary] too bad design. Need to peek it from cfs
 	 * instead of hacking ugly like this */
 	CAMEL_SUMMARY_LOCK(s, summary_lock);
-	CAMEL_SUMMARY_LOCK(s, ref_lock);
 
 	info = g_hash_table_lookup (s->loaded_infos, uid);
 
 	if (info)
-		info->refcount++;
+		camel_message_info_ref (info);
 
-	CAMEL_SUMMARY_UNLOCK(s, ref_lock);
 	CAMEL_SUMMARY_UNLOCK(s, summary_lock);
 
 	if (!info) {
@@ -503,6 +501,7 @@ camel_vee_summary_add(CamelVeeSummary *s, CamelFolderSummary *summary, const gch
 			camel_object_ref(summary);
 		}
 
+		camel_message_info_ref (mi);
 		return mi;
 	}
 



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