evolution-data-server r8588 - trunk/camel/providers/imap
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8588 - trunk/camel/providers/imap
- Date: Thu, 27 Mar 2008 12:11:59 +0000 (GMT)
Author: mcrha
Date: Thu Mar 27 12:11:59 2008
New Revision: 8588
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8588&view=rev
Log:
2008-03-27 Milan Crha <mcrha redhat com>
** Fix for bug #520526
* camel-imap-folder.c: (imap_refresh_info), (imap_rescan),
(imap_update_summary):
Stop work as soon as we know application is going to exit.
Modified:
trunk/camel/providers/imap/ChangeLog
trunk/camel/providers/imap/camel-imap-folder.c
Modified: trunk/camel/providers/imap/camel-imap-folder.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-folder.c (original)
+++ trunk/camel/providers/imap/camel-imap-folder.c Thu Mar 27 12:11:59 2008
@@ -565,6 +565,7 @@
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
CamelImapResponse *response;
CamelStoreInfo *si;
+ extern int camel_application_is_exiting;
if (camel_disco_store_status (CAMEL_DISCO_STORE (imap_store)) == CAMEL_DISCO_STORE_OFFLINE)
return;
@@ -581,7 +582,7 @@
* should do it. */
CAMEL_SERVICE_REC_LOCK (imap_store, connect_lock);
- if (!camel_imap_store_connected(imap_store, ex))
+ if (camel_application_is_exiting || !camel_imap_store_connected(imap_store, ex))
goto done;
if (imap_store->current_folder != folder
@@ -692,7 +693,7 @@
new = g_malloc0 (summary_len * sizeof (*new));
summary_got = 0;
- while ((type = camel_imap_command_response (store, &resp, ex)) == CAMEL_IMAP_RESPONSE_UNTAGGED) {
+ while ((type = camel_imap_command_response (store, &resp, ex)) == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
GData *data;
char *uid;
guint32 flags;
@@ -718,10 +719,14 @@
}
camel_operation_end (NULL);
- if (type == CAMEL_IMAP_RESPONSE_ERROR) {
+ if (type == CAMEL_IMAP_RESPONSE_ERROR || camel_application_is_exiting) {
for (i = 0; i < summary_len && new[i].uid; i++)
g_free (new[i].uid);
g_free (new);
+
+ if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
+
return;
}
@@ -2489,6 +2494,7 @@
CamelStream *stream;
char *uid, *resp;
GData *data;
+ extern int camel_application_is_exiting;
if (store->server_level >= IMAP_LEVEL_IMAP4REV1) {
if (store->headers == IMAP_FETCH_ALL_HEADERS)
@@ -2544,7 +2550,7 @@
fetch_data = g_ptr_array_new ();
messages = g_ptr_array_new ();
while ((type = camel_imap_command_response (store, &resp, ex)) ==
- CAMEL_IMAP_RESPONSE_UNTAGGED) {
+ CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
data = parse_fetch_response (imap_folder, resp);
g_free (resp);
if (!data)
@@ -2576,8 +2582,12 @@
}
camel_operation_end (NULL);
- if (type == CAMEL_IMAP_RESPONSE_ERROR)
+ if (type == CAMEL_IMAP_RESPONSE_ERROR || camel_application_is_exiting) {
+ if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
+
goto lose;
+ }
/* Free the final tagged response */
g_free (resp);
@@ -2607,7 +2617,7 @@
camel_operation_start (NULL, _("Fetching summary information for new messages in %s"), folder->name);
- while (uid < needheaders->len) {
+ while (uid < needheaders->len && !camel_application_is_exiting) {
uidset = imap_uid_array_to_set (folder->summary, needheaders, uid, UID_SET_LIMIT, &uid);
if (!camel_imap_command_start (store, folder, ex,
"UID FETCH %s BODY.PEEK[%s]",
@@ -2621,7 +2631,7 @@
g_free (uidset);
while ((type = camel_imap_command_response (store, &resp, ex))
- == CAMEL_IMAP_RESPONSE_UNTAGGED) {
+ == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
data = parse_fetch_response (imap_folder, resp);
g_free (resp);
if (!data)
@@ -2636,9 +2646,13 @@
g_datalist_clear (&data);
}
- if (type == CAMEL_IMAP_RESPONSE_ERROR) {
+ if (type == CAMEL_IMAP_RESPONSE_ERROR || camel_application_is_exiting) {
g_ptr_array_free (needheaders, TRUE);
camel_operation_end (NULL);
+
+ if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
+ CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
+
goto lose;
}
}
@@ -2718,6 +2732,12 @@
}
g_ptr_array_free (fetch_data, TRUE);
+ if (camel_application_is_exiting) {
+ /* it will hopefully update summary next time */
+ fetch_data = NULL;
+ goto lose;
+ }
+
/* And add the entries to the summary, etc. */
for (i = 0; i < messages->len; i++) {
mi = messages->pdata[i];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]