From 14b159cabd30ad4ccae3b5a814b1c7e95639fdb3 Mon Sep 17 00:00:00 2001 From: Ulrich Kitzinger Date: Thu, 27 Feb 2014 18:15:06 +0100 Subject: Zugriff auf static Variable synchronisiert (Trac 11400) Change-Id: I623650afee10cc60b49067f4efbdc889b58007dc --- sw/source/core/attr/calbck.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 23226cb67b56..d483b4cfde11 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -24,6 +24,7 @@ #include // mba: get rid of that dependency static SwClientIter* pClientIters = 0; +static ::osl::Mutex m_IterMutex; TYPEINIT0( SwClient ); @@ -225,6 +226,7 @@ void SwModify::Add( SwClient* pDepend ) if(pDepend->pRegisteredIn != this ) { #if OSL_DEBUG_LEVEL > 0 + osl::MutexGuard aLock( m_IterMutex ); SwClientIter* pTmp = pClientIters; while( pTmp ) { @@ -280,6 +282,7 @@ SwClient* SwModify::Remove( SwClient* pDepend ) pR->pLeft = pL; // update ClientIters + osl::MutexGuard aLock( m_IterMutex ); SwClientIter* pTmp = pClientIters; while( pTmp ) { @@ -340,6 +343,7 @@ void SwModify::CheckCaching( const sal_uInt16 nWhich ) void SwModify::CallSwClientNotify( const SfxHint& rHint ) const { SwClientIter aIter(*this); + osl::MutexGuard aLock( m_IterMutex ); SwClient* pClient = aIter.GoStart(); while( pClient ) { @@ -351,6 +355,7 @@ void SwModify::CallSwClientNotify( const SfxHint& rHint ) const void SwModify::ModifyBroadcast( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, TypeId nType ) { SwClientIter aIter( *this ); + osl::MutexGuard aLock( m_IterMutex ); SwClient* pClient = aIter.First( nType ); while( pClient ) { @@ -396,6 +401,7 @@ SwClientIter::SwClientIter( const SwModify& rModify ) : rRoot( rModify ) { pNxtIter = 0; + osl::MutexGuard aLock( m_IterMutex ); if( pClientIters ) { // append to list of ClientIters @@ -415,6 +421,7 @@ SwClientIter::SwClientIter( const SwModify& rModify ) SwClientIter::~SwClientIter() { + osl::MutexGuard aLock( m_IterMutex ); if( pClientIters ) { // reorganize list of ClientIters -- cgit