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

Michael Stahl mstahl at redhat.com
Tue Mar 13 16:14:40 UTC 2018


 vcl/osx/salinst.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 226ec5aebb65f4017c29bc3aaacfaa5782dfbbb7
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Feb 23 12:44:33 2018 +0100

    vcl: race in OSX SalYieldMutex::doRelease
    
    m_nCount must be accessed with m_aMutex locked.
    
    Change-Id: I7e05cac2b549b975804d6061721c1da4d0b9f64e
    Reviewed-on: https://gerrit.libreoffice.org/50236
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index e008357b3641..891281614cb1 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -330,8 +330,10 @@ sal_uInt32 SalYieldMutex::doRelease( const bool bUnlockAll )
     sal_uInt32 nCount;
     {
         std::unique_lock<std::mutex> g(m_runInMainMutex);
+        // read m_nCount before doRelease
+        bool const isReleased(bUnlockAll || m_nCount == 1);
         nCount = comphelper::GenericSolarMutex::doRelease( bUnlockAll );
-        if ( 0 == m_nCount && !pInst->IsMainThread() ) {
+        if (isReleased && !pInst->IsMainThread()) {
             m_wakeUpMain = true;
             m_aInMainCondition.notify_all();
         }


More information about the Libreoffice-commits mailing list