From 3ed39dee48f6fd603a4f088caae6f5df6847d63e Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 27 Oct 2006 21:25:04 -0400 Subject: [PATCH] additional cache locking patch --- src/cairo-cache.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/cairo-cache.c b/src/cairo-cache.c index 9d64d27..2c8edf6 100644 --- a/src/cairo-cache.c +++ b/src/cairo-cache.c @@ -318,16 +318,20 @@ _cairo_cache_insert (cairo_cache_t *cac cairo_cache_entry_t *entry) { cairo_status_t status; + CAIRO_MUTEX_LOCK (cairo_cache_refcount_mutex); _cairo_cache_shrink_to_accomodate (cache, entry->size); status = _cairo_hash_table_insert (cache->hash_table, (cairo_hash_entry_t *) entry); - if (status) + if (status){ + CAIRO_MUTEX_UNLOCK (cairo_cache_refcount_mutex); return status; + } cache->size += entry->size; + CAIRO_MUTEX_UNLOCK (cairo_cache_refcount_mutex); return CAIRO_STATUS_SUCCESS; } @@ -347,6 +351,7 @@ static void _cairo_cache_remove (cairo_cache_t *cache, cairo_cache_entry_t *entry) { + CAIRO_MUTEX_LOCK (cairo_cache_refcount_mutex); cache->size -= entry->size; _cairo_hash_table_remove (cache->hash_table, @@ -354,6 +359,7 @@ _cairo_cache_remove (cairo_cache_t *cac if (cache->entry_destroy) cache->entry_destroy (entry); + CAIRO_MUTEX_LOCK (cairo_cache_refcount_mutex); } /** -- 1.4.1.1