diff options
author | Dan Winship <danw@src.gnome.org> | 2001-06-27 03:20:01 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-06-27 03:20:01 +0800 |
commit | 4fb01ff2ff50c15ddae5c676e616e77c98e09054 (patch) | |
tree | 51aeb0bc2887cdc19fdacca92eca75e17f664395 /camel | |
parent | 03d2f262c0d2094b8b4d7fdbeb45adbff0ade372 (diff) | |
download | gsoc2013-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')
-rw-r--r-- | camel/ChangeLog | 12 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 11 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 8 |
3 files changed, 25 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 3bfbaf2c08..89c56e8228 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,6 +1,16 @@ 2001-06-26 Dan Winship <danw@ximian.com> - * camel-url.c (camel_url_encode): constify args + * 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... + + * camel-service.c (camel_service_get_url): D'oh. + s/FALSE/CAMEL_URL_HIDE_PASSWORD/ 2001-06-25 Jeffrey Stedfast <fejj@ximian.com> 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); } diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index eecc7b0e35..a86a3b51e7 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -872,12 +872,14 @@ get_folder_online (CamelStore *store, const char *folder_name, g_free (folder_dir); if (new_folder) { imap_store->current_folder = new_folder; + camel_object_ref (CAMEL_OBJECT (new_folder)); camel_imap_folder_selected (new_folder, response, ex); if (camel_exception_is_set (ex)) { + camel_object_unref (CAMEL_OBJECT (imap_store->current_folder)); + imap_store->current_folder = NULL; camel_object_unref (CAMEL_OBJECT (new_folder)); - new_folder = imap_store->current_folder = NULL; - } else - camel_object_ref (CAMEL_OBJECT (imap_store->current_folder)); + new_folder = NULL; + } } camel_imap_response_free_without_processing (imap_store, response); |