summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-04-24 22:40:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-04-26 13:19:26 +0200
commit9b3eeff056793d38c7933a676cc471c4724b126f (patch)
tree04b9b5c89111ca1c2369b33ebcb79d8bc290c905 /comphelper
parentf214d664123b3b093f33eb5386867eab26bd8361 (diff)
SolarMutex::m_nThreadId is read without SolarMutex::m_aMutex locked
...so better make it std::atomic<> (and it also can be private). And in SolarMutex::doRelease, make sure that m_nCount is only read with m_aMutex locked. Change-Id: Iee0c1465e60e07ccd8955010a3dbc15a99dbe807 Reviewed-on: https://gerrit.libreoffice.org/71260 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/solarmutex.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/comphelper/source/misc/solarmutex.cxx b/comphelper/source/misc/solarmutex.cxx
index 3a6b34af1947..b9747dbac1b3 100644
--- a/comphelper/source/misc/solarmutex.cxx
+++ b/comphelper/source/misc/solarmutex.cxx
@@ -60,9 +60,9 @@ void SolarMutex::doAcquire( const sal_uInt32 nLockCount )
sal_uInt32 SolarMutex::doRelease( bool bUnlockAll )
{
- if ( m_nCount == 0 )
+ if ( !IsCurrentThread() )
std::abort();
- if ( m_nThreadId != osl::Thread::getCurrentIdentifier() )
+ if ( m_nCount == 0 )
std::abort();
const sal_uInt32 nCount = bUnlockAll ? m_nCount : 1;