diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-08-09 10:02:35 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-08-09 10:02:35 +0200 |
commit | 92e1b9092de15890fe7fe7b314cb053049482fd0 (patch) | |
tree | b55acb496ef560f34ece78aef218306344e99d18 /vcl | |
parent | 77db82df17be6390d3187ef39067a5da0462aa96 (diff) |
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
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/scheduler.cxx | 13 |
1 files changed, 5 insertions, 8 deletions
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; } |