[evolution-data-server] Bug #588374 - crash in mbox's summary_update under spool provider



commit e90bf1211611c546b8341c38d2a149c5db6d796d
Author: Milan Crha <mcrha redhat com>
Date:   Mon Aug 10 11:22:07 2009 +0200

    Bug #588374 - crash in mbox's summary_update under spool provider

 camel/providers/local/camel-mbox-summary.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 7c2ecb9..5b422ac 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -594,16 +594,30 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 	for (i=0;i<count;i++) {
 		mi = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
 		/* must've dissapeared from the file? */
-		if (mi->info.info.flags & CAMEL_MESSAGE_FOLDER_NOTSEEN) {
-			d(printf("uid '%s' vanished, removing", camel_message_info_uid(mi)));
+		if (!mi || mi->info.info.flags & CAMEL_MESSAGE_FOLDER_NOTSEEN) {
+			gchar *uid;
+
+			if (mi)
+				uid = g_strdup (camel_message_info_uid (mi));
+			else
+				uid = camel_folder_summary_uid_from_index (s, i);
+
+			if (!uid) {
+				g_debug ("%s: didn't get uid at %d of %d (%d)", G_STRFUNC, i, count, camel_folder_summary_count (s));
+				continue;
+			}
+
+			d(printf("uid '%s' vanished, removing", uid));
 			if (changeinfo)
-				camel_folder_change_info_remove_uid(changeinfo, camel_message_info_uid(mi));
-			del = g_slist_prepend(del, (gpointer) camel_pstring_strdup(camel_message_info_uid(mi)));
+				camel_folder_change_info_remove_uid (changeinfo, uid);
+			del = g_slist_prepend (del, (gpointer) camel_pstring_strdup (uid));
 			camel_folder_summary_remove_index_fast (s, i);
 			count--;
 			i--;
+			g_free (uid);
 		}
-		camel_message_info_free(mi);
+		if (mi)
+			camel_message_info_free (mi);
 	}
 
 	/* Delete all in one transaction */



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