aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-folder.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-06-27 03:20:01 +0800
committerDan Winship <danw@src.gnome.org>2001-06-27 03:20:01 +0800
commit4fb01ff2ff50c15ddae5c676e616e77c98e09054 (patch)
tree51aeb0bc2887cdc19fdacca92eca75e17f664395 /camel/providers/imap/camel-imap-folder.c
parent03d2f262c0d2094b8b4d7fdbeb45adbff0ade372 (diff)
downloadgsoc2013-evolution-4fb01ff2ff50c15ddae5c676e616e77c98e09054.tar
gsoc2013-evolution-4fb01ff2ff50c15ddae5c676e616e77c98e09054.tar.gz
gsoc2013-evolution-4fb01ff2ff50c15ddae5c676e616e77c98e09054.tar.bz2
gsoc2013-evolution-4fb01ff2ff50c15ddae5c676e616e77c98e09054.tar.lz
gsoc2013-evolution-4fb01ff2ff50c15ddae5c676e616e77c98e09054.tar.xz
gsoc2013-evolution-4fb01ff2ff50c15ddae5c676e616e77c98e09054.tar.zst
gsoc2013-evolution-4fb01ff2ff50c15ddae5c676e616e77c98e09054.zip
lock the cache around accesses
* providers/imap/camel-imap-folder.c (camel_imap_folder_selected, imap_append_offline, imap_append_online, camel_imap_folder_changed): lock the cache around accesses * providers/imap/camel-imap-store.c (get_folder_online): ref the newly-created folder (as current_folder) before calling camel_imap_folder_selected, in case that needs to do something that causes another folder to become current... svn path=/trunk/; revision=10509
Diffstat (limited to 'camel/providers/imap/camel-imap-folder.c')
-rw-r--r--camel/providers/imap/camel-imap-folder.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index d9f6e66f32..bf839a47eb 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -41,6 +41,7 @@
#include "camel-imap-folder.h"
#include "camel-imap-command.h"
#include "camel-imap-message-cache.h"
+#include "camel-imap-private.h"
#include "camel-imap-search.h"
#include "camel-imap-store.h"
#include "camel-imap-summary.h"
@@ -49,7 +50,6 @@
#include "camel-data-wrapper.h"
#include "camel-disco-diary.h"
#include "camel-exception.h"
-#include "camel-imap-private.h"
#include "camel-mime-filter-crlf.h"
#include "camel-mime-filter-from.h"
#include "camel-mime-message.h"
@@ -277,7 +277,9 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
else if (validity != imap_summary->validity) {
imap_summary->validity = validity;
camel_folder_summary_clear (folder->summary);
+ CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
camel_imap_message_cache_clear (imap_folder->cache);
+ CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
imap_folder->need_rescan = FALSE;
camel_imap_folder_changed (folder, exists, NULL, ex);
return;
@@ -862,8 +864,10 @@ imap_append_offline (CamelFolder *folder, CamelMimeMessage *message,
CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
camel_imap_summary_add_offline (folder->summary, uid, message, info);
+ CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock);
camel_imap_message_cache_insert_wrapper (cache, uid, "",
CAMEL_DATA_WRAPPER (message));
+ CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
changes = camel_folder_change_info_new ();
camel_folder_change_info_add_uid (changes, uid);
@@ -966,9 +970,11 @@ imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
/* Cache first, since freeing response may trigger a
* summary update that will want this information.
*/
+ CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock);
camel_imap_message_cache_insert_wrapper (
CAMEL_IMAP_FOLDER (folder)->cache,
uid, "", CAMEL_DATA_WRAPPER (message));
+ CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
g_free (uid);
}
@@ -1625,8 +1631,9 @@ camel_imap_folder_changed (CamelFolder *folder, int exists,
id = g_array_index (expunged, int, i);
info = camel_folder_summary_index (folder->summary, id - 1);
camel_folder_change_info_remove_uid (changes, camel_message_info_uid (info));
- /* It's safe to not lock around this. */
+ CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock);
camel_imap_message_cache_remove (imap_folder->cache, camel_message_info_uid (info));
+ CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
camel_folder_summary_remove (folder->summary, info);
camel_folder_summary_info_free(folder->summary, info);
}