[Libreoffice-commits] .: sal/rtl

David Tardon dtardon at kemper.freedesktop.org
Mon Dec 27 00:34:43 PST 2010


 sal/rtl/source/alloc_cache.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit f9344d0a6cb06ccb31defea83e163cf15091104a
Author: David Tardon <dtardon at redhat.com>
Date:   Sun Dec 26 10:29:06 2010 +0100

    avoid data race with wsupdate thread

diff --git a/sal/rtl/source/alloc_cache.c b/sal/rtl/source/alloc_cache.c
index 916461e..42df973 100644
--- a/sal/rtl/source/alloc_cache.c
+++ b/sal/rtl/source/alloc_cache.c
@@ -1189,10 +1189,9 @@ SAL_CALL rtl_cache_alloc (
     if (cache == 0)
         return (0);
 
+    RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock));
     if (cache->m_cpu_curr != 0)
     {
-        RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock));
-
         for (;;)
         {
             /* take object from magazine layer */
@@ -1230,9 +1229,8 @@ SAL_CALL rtl_cache_alloc (
             /* no full magazine: fall through to slab layer */
             break;
         }
-
-        RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock));
     }
+    RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock));
 
     /* alloc buffer from slab layer */
     obj = rtl_cache_slab_alloc (cache);


More information about the Libreoffice-commits mailing list