[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Wed Aug 9 06:49:29 UTC 2017


 vcl/source/app/scheduler.cxx |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

New commits:
commit bf710e39949217e0f62606bf8da2171811d63d39
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 9 08:46:13 2017 +0200

    SchedulerMutex::release: don't read mnLockDepth with maMutex already unlocked
    
    ...another thread may already have called SchedulerMutex::acquire in between,
    whose effect would then be canceled
    
    Change-Id: Icddb6ea47144366c3a81bc83e3f9469b25a18c22

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 41d7e7124d85..2976f99cbc3a 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -134,19 +134,9 @@ sal_uInt32 SchedulerMutex::release( bool bUnlockAll )
     sal_uInt32 nLockCount = 0;
     if ( mnLockDepth )
     {
-        if ( bUnlockAll )
-        {
-            nLockCount = mnLockDepth;
-            do {
-                --mnLockDepth;
-                maMutex.release();
-            }
-            while ( mnLockDepth );
-        }
-        else
-        {
-            nLockCount = 1;
-            --mnLockDepth;
+        nLockCount = bUnlockAll ? mnLockDepth : 1;
+        mnLockDepth -= nLockCount;
+        for (sal_uInt32 i = 0; i != nLockCount; ++i) {
             maMutex.release();
         }
     }


More information about the Libreoffice-commits mailing list