diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-15 03:42:40 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-15 03:42:40 +0800 |
commit | ed5d621b6db1ab269db125ddab338b48b824a737 (patch) | |
tree | 2f49149c5d08b248769b3afcbbd1006e80e9e05e | |
parent | 57d8850901056acec960568d6e9785018f00411d (diff) | |
download | gsoc2013-evolution-ed5d621b6db1ab269db125ddab338b48b824a737.tar.gz gsoc2013-evolution-ed5d621b6db1ab269db125ddab338b48b824a737.tar.zst gsoc2013-evolution-ed5d621b6db1ab269db125ddab338b48b824a737.zip |
After talking to NotZed, it turns out I was wrong after all. (store_sync):
2001-08-13 Jeffrey Stedfast <fejj@ximian.com>
* camel-store.c (camel_store_get_folder): After talking to NotZed,
it turns out I was wrong after all.
(store_sync): Create a copy of the folder-cache that owns a ref on
each of the folders so that if one of the folders get's finalized
inside store_sync(), we don't run into any locking issues. This is
mostly meant to solve a problem in IMAP (#6089).
svn path=/trunk/; revision=12032
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/camel-store.c | 22 |
2 files changed, 28 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 547cdb12cf..b9169dc7c9 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2001-08-13 Jeffrey Stedfast <fejj@ximian.com> + + * camel-store.c (camel_store_get_folder): After talking to NotZed, + it turns out I was wrong after all. + (store_sync): Create a copy of the folder-cache that owns a ref on + each of the folders so that if one of the folders get's finalized + inside store_sync(), we don't run into any locking issues. This is + mostly meant to solve a problem in IMAP (#6089). + 2001-08-13 Peter Williams <peterw@ximian.com> * providers/imap/camel-imap-store.c (delete_folder): Fix a leak. diff --git a/camel/camel-store.c b/camel/camel-store.c index 7abea71392..0a0132e543 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -227,7 +227,6 @@ 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); @@ -439,6 +438,16 @@ sync_folder (gpointer key, gpointer folder, gpointer ex) { if (!camel_exception_is_set (ex)) camel_folder_sync (folder, FALSE, ex); + + camel_object_unref (CAMEL_OBJECT (folder)); + g_free (key); +} + +static void +copy_folder_cache (gpointer key, gpointer folder, gpointer hash) +{ + g_hash_table_insert ((GHashTable *) hash, g_strdup (key), folder); + camel_object_ref (CAMEL_OBJECT (folder)); } static void @@ -446,12 +455,19 @@ store_sync (CamelStore *store, CamelException *ex) { if (store->folders) { CamelException internal_ex; - + GHashTable *hash; + + hash = g_hash_table_new (CS_CLASS (store)->hash_folder_name, + CS_CLASS (store)->compare_folder_name); + camel_exception_init (&internal_ex); CAMEL_STORE_LOCK(store, cache_lock); - g_hash_table_foreach (store->folders, sync_folder, &internal_ex); + g_hash_table_foreach (store->folders, copy_folder_cache, hash); CAMEL_STORE_UNLOCK(store, cache_lock); camel_exception_xfer (ex, &internal_ex); + + g_hash_table_foreach (hash, sync_folder, &internal_ex); + g_hash_table_destroy (hash); } } |