aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-data-cache.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-01-21 09:26:04 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-01-21 09:26:04 +0800
commit855cc92b474f9fc863915942dbb7193817dc6dc0 (patch)
tree66940279e5a02a4916b9189be59a5afe4aff76f9 /camel/camel-data-cache.c
parent494acd418eb1bfe205afe727878cb60dc0441e37 (diff)
downloadgsoc2013-evolution-855cc92b474f9fc863915942dbb7193817dc6dc0.tar.gz
gsoc2013-evolution-855cc92b474f9fc863915942dbb7193817dc6dc0.tar.zst
gsoc2013-evolution-855cc92b474f9fc863915942dbb7193817dc6dc0.zip
** See bug #52996.
2004-01-21 Not Zed <NotZed@Ximian.com> ** See bug #52996. * camel-data-cache.c (camel_data_cache_add): put a do-loop around the object_bag_reserve stuff, otherwise we can add/abort out of sync (i.e. when object_bag_reserve returned a pointer we mustn't call add/abort). * camel-object.c (camel_object_bag_*): Added some inline doco. ~ ~ ~ ~ ~ ~ svn path=/trunk/; revision=24339
Diffstat (limited to 'camel/camel-data-cache.c')
-rw-r--r--camel/camel-data-cache.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/camel/camel-data-cache.c b/camel/camel-data-cache.c
index a585f59a9d..3a2586e3a9 100644
--- a/camel/camel-data-cache.c
+++ b/camel/camel-data-cache.c
@@ -287,12 +287,17 @@ camel_data_cache_add(CamelDataCache *cdc, const char *path, const char *key, Cam
CamelStream *stream;
real = data_cache_path(cdc, TRUE, path, key);
- stream = camel_object_bag_reserve(cdc->priv->busy_bag, real);
- if (stream) {
- unlink(real);
- camel_object_bag_remove(cdc->priv->busy_bag, stream);
- camel_object_unref(stream);
- }
+ /* need to loop 'cause otherwise we can call bag_add/bag_abort
+ * after bag_reserve returned a pointer, which is an invalid
+ * sequence. */
+ do {
+ stream = camel_object_bag_reserve(cdc->priv->busy_bag, real);
+ if (stream) {
+ unlink(real);
+ camel_object_bag_remove(cdc->priv->busy_bag, stream);
+ camel_object_unref(stream);
+ }
+ } while (stream != NULL);
stream = camel_stream_fs_new_with_name(real, O_RDWR|O_CREAT|O_TRUNC, 0600);
if (stream)