diff options
author | 9 <NotZed@Ximian.com> | 2001-10-19 13:33:21 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-19 13:33:21 +0800 |
commit | 0515ef5e4d5d138f1f7e9956b7a643cc01d7cf19 (patch) | |
tree | 81be21ec9add33d807bd7150887da30db713e5af /camel/camel-store.c | |
parent | ec619f7bfaf14ee913f565664459103507adb34f (diff) | |
download | gsoc2013-evolution-0515ef5e4d5d138f1f7e9956b7a643cc01d7cf19.tar.gz gsoc2013-evolution-0515ef5e4d5d138f1f7e9956b7a643cc01d7cf19.tar.zst gsoc2013-evolution-0515ef5e4d5d138f1f7e9956b7a643cc01d7cf19.zip |
Lock the right lock for unmatched subfolder list stuff. If the sub folder
2001-10-19 <NotZed@Ximian.com>
* camel-vee-folder.c (camel_vee_folder_remove_folder): Lock the
right lock for unmatched subfolder list stuff. If the sub folder
is deleted & part of unmatched, or the last ref to the sub folder
is gone from unmatched, blow it away completely from unmatched,
but only do it once.
(vee_folder_remove_folder): Added arg to kill unmatched
unconditionally. Also handle deleted folders, always remove
stuff.
(folder_changed_change): Lock subfolder lock for entirety of
operation, and also check to see if the subfolder is still there
before doing any fancy work (incase it got removed while we were
waiting to execute).
* camel-store.c (camel_store_unsubscribe_folder): If we are
unsubscribing from a folder we have loaded, set the folder
deleted, as with the delete_folder case.
svn path=/trunk/; revision=13786
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r-- | camel/camel-store.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c index 3cd695f1bc..df2f5bebb2 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -330,6 +330,8 @@ camel_store_delete_folder (CamelStore *store, const char *folder_name, CamelExce char *key; CAMEL_STORE_LOCK(store, folder_lock); + + /* NB: Note similarity of this code to unsubscribe_folder */ /* if we deleted a folder, force it out of the cache, and also out of the vtrash if setup */ if (store->folders) { @@ -960,13 +962,45 @@ camel_store_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelException *ex) { + CamelFolder *folder = NULL; + char *key; + g_return_if_fail (CAMEL_IS_STORE (store)); g_return_if_fail (store->flags & CAMEL_STORE_SUBSCRIPTIONS); CAMEL_STORE_LOCK(store, folder_lock); + /* NB: Note similarity of this code to delete_folder */ + + /* if we deleted a folder, force it out of the cache, and also out of the vtrash if setup */ + if (store->folders) { + CAMEL_STORE_LOCK(store, cache_lock); + folder = g_hash_table_lookup(store->folders, folder_name); + if (folder) + camel_object_ref((CamelObject *)folder); + CAMEL_STORE_UNLOCK(store, cache_lock); + + if (folder) { + if (store->vtrash) + camel_vee_folder_remove_folder((CamelVeeFolder *)store->vtrash, folder); + camel_folder_delete (folder); + } + } + CS_CLASS (store)->unsubscribe_folder (store, folder_name, ex); + if (folder) + camel_object_unref((CamelObject *)folder); + + if (store->folders) { + CAMEL_STORE_LOCK(store, cache_lock); + if (g_hash_table_lookup_extended(store->folders, folder_name, (void **)&key, (void **)&folder)) { + g_hash_table_remove (store->folders, key); + g_free (key); + } + CAMEL_STORE_UNLOCK(store, cache_lock); + } + CAMEL_STORE_UNLOCK(store, folder_lock); } |