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

Stephan Bergmann sbergman at redhat.com
Wed Aug 9 08:06:24 UTC 2017


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

New commits:
commit 92e1b9092de15890fe7fe7b314cb053049482fd0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 9 10:02:35 2017 +0200

    Remove unnecessary, broken check for mnLockDepth != 0
    
    If SchedulerMutex::release were ever called from a thread not having locked the
    mutex, mnLockDepth would have an arbitrary value, not necessarily zero.  It is
    clear that SchedulerMutex::release must only be called by a thread that has the
    mutex locked, so the check was redundant.
    
    Change-Id: I4969b8e6543657602494e333a6a3ea07d83267d1

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 2976f99cbc3a..26d904e0f661 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -131,14 +131,11 @@ bool SchedulerMutex::acquire( sal_uInt32 nLockCount )
 
 sal_uInt32 SchedulerMutex::release( bool bUnlockAll )
 {
-    sal_uInt32 nLockCount = 0;
-    if ( mnLockDepth )
-    {
-        nLockCount = bUnlockAll ? mnLockDepth : 1;
-        mnLockDepth -= nLockCount;
-        for (sal_uInt32 i = 0; i != nLockCount; ++i) {
-            maMutex.release();
-        }
+    assert(mnLockDepth != 0);
+    sal_uInt32 nLockCount = bUnlockAll ? mnLockDepth : 1;
+    mnLockDepth -= nLockCount;
+    for (sal_uInt32 i = 0; i != nLockCount; ++i) {
+        maMutex.release();
     }
     return nLockCount;
 }


More information about the Libreoffice-commits mailing list