--- evolution-data-server-2.30.3/camel/camel-folder-summary.c.orig	2010-09-10 16:28:35.145748131 +0800
+++ evolution-data-server-2.30.3/camel/camel-folder-summary.c	2010-09-10 16:29:03.858282682 +0800
@@ -1614,12 +1614,12 @@
 
 	d(printf ("\ncamel_folder_summary_save_to_db called \n"));
 	if (_PRIVATE(s)->need_preview && g_hash_table_size(_PRIVATE(s)->preview_updates)) {
-		camel_db_begin_transaction (s->folder->parent_store->cdb_w, NULL);
 		CAMEL_SUMMARY_LOCK(s, summary_lock);
+		camel_db_begin_transaction (s->folder->parent_store->cdb_w, NULL);
 		g_hash_table_foreach (_PRIVATE(s)->preview_updates, (GHFunc)msg_save_preview, s->folder);
 		g_hash_table_remove_all (_PRIVATE(s)->preview_updates);
-		CAMEL_SUMMARY_UNLOCK(s, summary_lock);
 		camel_db_end_transaction (s->folder->parent_store->cdb_w, NULL);
+		CAMEL_SUMMARY_UNLOCK(s, summary_lock);
 	}
 
 	if (!(s->flags & CAMEL_SUMMARY_DIRTY))
