Index: camel/providers/imap/ChangeLog
===================================================================
--- camel/providers/imap/ChangeLog	(revision 9729)
+++ camel/providers/imap/ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2008-11-05  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #558737
+
+	* camel-imap-folder.c: (handle_copyuid_copy_user_tags),
+	(imap_transfer_online): Do not use 'camel_folder_refresh_folder', use
+	'imap_refresh_folder' instead, because the former locks the folder
+	lock too, which could make a deadlock when we are refreshing that
+	folder in other thread, which is waiting for the connect lock we hold.
+
 2008-10-17  Srinivasa Ragavan  <sragavan@novell.com>
 
 	** Fix for bug #556688
Index: camel/providers/imap/camel-imap-folder.c
===================================================================
--- camel/providers/imap/camel-imap-folder.c	(revision 9729)
+++ camel/providers/imap/camel-imap-folder.c	(working copy)
@@ -2158,7 +2158,7 @@ handle_copyuid_copy_user_tags (CamelImap
 	camel_exception_init (&ex);
 	/* refresh folder's summary first, we copied messages there on the server,
 	   but do not know about it in a local summary */
-	camel_folder_refresh_info (destination, &ex);
+	imap_refresh_info (destination, &ex);
 	if (camel_exception_is_set (&ex)) {
 		g_warning ("destination folder refresh failed, error: %s", ex.desc);
 		camel_exception_clear (&ex);
@@ -2304,7 +2304,7 @@ imap_transfer_online (CamelFolder *sourc
 	/* Make the destination notice its new messages */
 	if (store->current_folder != dest ||
 	    camel_folder_summary_count (dest->summary) == count)
-		camel_folder_refresh_info (dest, ex);
+		imap_refresh_info (dest, ex);
 	
 	/* FIXME */
 	if (transferred_uids)
