commit ef15c73fb45c595f80611eb86b2fdd1d0efd6a68
Author: Thomas Mittelstaedt <tmstaedt@t-mittelstaedt.de>
Date:   Thu May 27 04:04:40 2010 +0200

    My adaptation of patch https://bugzilla.gnome.org/attachment.cgi?id=162044, which is for git master, to gnome-2-28

diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 5b422ac..ce44a95 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -866,6 +866,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 	camel_mime_parser_scan_pre_from(mp, TRUE);
 	camel_mime_parser_init_with_fd(mp, pfd);
 
+	CAMEL_SUMMARY_LOCK(s, summary_lock);
 	/* Sync only the changes */
 	summary = camel_folder_summary_get_changed ((CamelFolderSummary *)mbs);
 	if (summary->len)
@@ -964,6 +965,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 	camel_object_unref((CamelObject *)mp);
 
 	camel_operation_end(NULL);
+	CAMEL_SUMMARY_UNLOCK(s, summary_lock);
 
 	return 0;
  error:
@@ -1090,6 +1092,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 	camel_mime_parser_scan_pre_from(mp, TRUE);
 	camel_mime_parser_init_with_fd(mp, fd);
 
+	CAMEL_SUMMARY_LOCK(s, summary_lock);
 	count = camel_folder_summary_count(s);
 	for (i = 0; i < count; i++) {
 		gint pc = (i + 1) * 100 / count;
@@ -1253,6 +1256,8 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 
 	if (touched)
 		camel_folder_summary_header_save_to_db (s, ex);
+	
+	CAMEL_SUMMARY_UNLOCK(s, summary_lock);
 
 	return 0;
  error:
@@ -1262,7 +1267,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 		camel_object_unref((CamelObject *)mp);
 	if (info)
 		camel_message_info_free((CamelMessageInfo *)info);
-
+	
+	CAMEL_SUMMARY_UNLOCK(s, summary_lock);
+	
 	return -1;
 }
 
