diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-08-09 08:46:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-08-09 08:46:13 +0200 |
commit | bf710e39949217e0f62606bf8da2171811d63d39 (patch) | |
tree | 8074ed9e36c9eb12be3d0795660bc9672cbd1718 | |
parent | 2585eb9d15f5c047d846ccb4b4d606d9ac89e518 (diff) |
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
-rw-r--r-- | vcl/source/app/scheduler.cxx | 16 |
1 files changed, 3 insertions, 13 deletions
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(); } } |