diff options
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r-- | camel/camel-store.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c index 96c6a0c8bc..792dd6c6f9 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -320,32 +320,39 @@ void camel_store_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) { CamelFolder *folder = NULL; + char *key; CAMEL_STORE_LOCK(store, folder_lock); /* if we deleted a folder, force it out of the cache, and also out of the vtrash if setup */ if (store->folders) { - char *key; - + 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)->delete_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_object_ref (CAMEL_OBJECT (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); - camel_object_unref (CAMEL_OBJECT (folder)); - } - - CS_CLASS (store)->delete_folder (store, folder_name, ex); - CAMEL_STORE_UNLOCK(store, folder_lock); } |