Index: camel/camel.c =================================================================== --- camel/camel.c.orig +++ camel/camel.c @@ -44,6 +44,8 @@ static int initialised = FALSE; +int camel_application_is_exiting = FALSE; + static void camel_shutdown (void) { Index: camel/providers/imap/camel-imap-folder.c =================================================================== --- camel/providers/imap/camel-imap-folder.c.orig +++ camel/providers/imap/camel-imap-folder.c @@ -605,6 +605,7 @@ imap_rescan (CamelFolder *folder, int ex { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); + extern int camel_application_is_exiting; struct { char *uid; guint32 flags; @@ -618,6 +619,9 @@ imap_rescan (CamelFolder *folder, int ex gboolean ok; CamelFolderChangeInfo *changes = NULL; + if (camel_application_is_exiting) + return; + imap_folder->need_rescan = FALSE; summary_len = camel_folder_summary_count (folder->summary); @@ -2634,6 +2638,7 @@ camel_imap_folder_changed (CamelFolder * GArray *expunged, CamelException *ex) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); + extern int camel_application_is_exiting; CamelFolderChangeInfo *changes; CamelMessageInfo *info; int len; @@ -2661,7 +2666,7 @@ camel_imap_folder_changed (CamelFolder * } len = camel_folder_summary_count (folder->summary); - if (exists > len) + if (exists > len && !camel_application_is_exiting) imap_update_summary (folder, exists, changes, ex); if (camel_folder_change_info_changed (changes)) Index: camel/providers/groupwise/camel-groupwise-folder.c =================================================================== --- camel/providers/groupwise/camel-groupwise-folder.c.orig +++ camel/providers/groupwise/camel-groupwise-folder.c @@ -60,7 +60,7 @@ #define ADD_JUNK_ENTRY 1 #define REMOVE_JUNK_ENTRY -1 #define JUNK_FOLDER "Junk Mail" -#define READ_CURSOR_MAX_IDS 500 +#define READ_CURSOR_MAX_IDS 50 #define MAX_ATTACHMENT_SIZE 1*1024*1024 /*In bytes*/ #define GROUPWISE_BULK_DELETE_LIMIT 100 @@ -856,6 +856,9 @@ struct _folder_update_msg { static void update_update (CamelSession *session, CamelSessionThreadMsg *msg) { + + extern int camel_application_is_exiting; + struct _folder_update_msg *m = (struct _folder_update_msg *)msg; EGwConnectionStatus status; CamelException *ex = NULL; @@ -874,7 +877,7 @@ update_update (CamelSession *session, Ca done = FALSE; m->slist = NULL; - while (!done) { + while (!done && !camel_application_is_exiting) { item_list = NULL; status = e_gw_connection_get_all_mail_uids (m->cnc, m->container_id, cursor, FALSE, READ_CURSOR_MAX_IDS, position, &item_list); if (status != E_GW_CONNECTION_STATUS_OK) {