aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog3
-rw-r--r--camel/camel-store.c1
-rw-r--r--camel/providers/imap/camel-imap-folder.c28
3 files changed, 18 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 3bc1ae3f07..547cdb12cf 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -13,6 +13,9 @@
* camel-store.c (camel_store_get_folder): We need to be ref'ing
the folder if/when we add it to the hash. This may fix bug #6089?
(camel_store_get_folder): Nevermind, reverted the fix.
+ (camel_store_get_folder): No, I wasn't on crack before after
+ all...if we don't ref here, then we're open to a race condition
+ later.
2001-08-11 Ettore Perazzoli <ettore@ximian.com>
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 602e4e45c5..7abea71392 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -227,6 +227,7 @@ camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flag
CAMEL_STORE_LOCK(store, cache_lock);
g_hash_table_insert (store->folders, g_strdup (folder_name), folder);
+ camel_object_ref (CAMEL_OBJECT (folder));
camel_object_hook_event (CAMEL_OBJECT (folder), "finalize", folder_finalize, store);
CAMEL_STORE_UNLOCK(store, cache_lock);
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index d0b9e01795..9c6f9da093 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -237,11 +237,11 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
GData *fetch_data;
int i, count;
char *resp;
-
+
CAMEL_IMAP_STORE_ASSERT_LOCKED (folder->parent_store, command_lock);
-
+
count = camel_folder_summary_count (folder->summary);
-
+
for (i = 0; i < response->untagged->len; i++) {
resp = response->untagged->pdata[i] + 2;
if (!g_strncasecmp (resp, "FLAGS ", 6) &&
@@ -255,7 +255,7 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
validity = strtoul (resp + 16, NULL, 10);
} else if (isdigit ((unsigned char)*resp)) {
unsigned long num = strtoul (resp, &resp, 10);
-
+
if (!g_strncasecmp (resp, " EXISTS", 7)) {
exists = num;
/* Remove from the response so nothing
@@ -266,18 +266,18 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
}
}
}
-
+
if (camel_disco_store_status (CAMEL_DISCO_STORE (folder->parent_store)) == CAMEL_DISCO_STORE_RESYNCING) {
if (validity != imap_summary->validity) {
camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_SUMMARY_INVALID,
_("Folder was destroyed and recreated on server."));
return;
}
-
+
/* FIXME: find missing UIDs ? */
return;
}
-
+
if (!imap_summary->validity)
imap_summary->validity = validity;
else if (validity != imap_summary->validity) {
@@ -290,13 +290,13 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
camel_imap_folder_changed (folder, exists, NULL, ex);
return;
}
-
+
/* If we've lost messages, we have to rescan everything */
if (exists < count)
imap_folder->need_rescan = TRUE;
else if (count != 0 && !imap_folder->need_rescan) {
CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
-
+
/* Similarly, if the UID of the highest message we
* know about has changed, then that indicates that
* messages have been both added and removed, so we
@@ -321,32 +321,32 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
}
if (uid != 0 || val != count || g_strncasecmp (resp, " FETCH (", 8) != 0)
continue;
-
+
fetch_data = parse_fetch_response (imap_folder, resp + 7);
uid = strtoul (g_datalist_get_data (&fetch_data, "UID"), NULL, 10);
g_datalist_clear (&fetch_data);
}
camel_imap_response_free_without_processing (store, response);
-
+
info = camel_folder_summary_index (folder->summary, count - 1);
val = strtoul (camel_message_info_uid (info), NULL, 10);
camel_folder_summary_info_free (folder->summary, info);
if (uid == 0 || uid != val)
imap_folder->need_rescan = TRUE;
}
-
+
/* Now rescan if we need to */
if (imap_folder->need_rescan) {
imap_rescan (folder, exists, ex);
return;
}
-
+
/* If we don't need to rescan completely, but new messages
* have been added, find out about them.
*/
if (exists > count)
camel_imap_folder_changed (folder, exists, NULL, ex);
-
+
/* And we're done. */
}