diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-04-07 20:48:24 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-04-09 14:43:07 +0200 |
commit | 46b1bb4a9c5ca93b33b4fcd2154062676c5059e4 (patch) | |
tree | eb09b7849d1e7b0b21d5d22bfebc89ad735ccf65 /vcl | |
parent | f01390010338ae627c990026c4ba579ab5eb266f (diff) |
Just use the ResettableGuard's functions...
... instead of the nested MutexGuard and clear.
Really had to look twice, that the MutexGuard and ResettableGuard
use the same Mutex - who came up with this... yup myself.
Change-Id: I70326772a9be8352f169a26467529a7c4100a20d
Reviewed-on: https://gerrit.libreoffice.org/70385
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/salusereventlist.cxx | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/vcl/source/app/salusereventlist.cxx b/vcl/source/app/salusereventlist.cxx index b71b5ed2031a..b0741af8ec9e 100644 --- a/vcl/source/app/salusereventlist.cxx +++ b/vcl/source/app/salusereventlist.cxx @@ -63,9 +63,7 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents ) oslThreadIdentifier aCurId = osl::Thread::getCurrentIdentifier(); DBG_TESTSOLARMUTEX(); - // cleared after we pop a single event and are save in the 2nd guard. - // this way we guarantee to process at least one event, if available. - osl::ResettableMutexGuard aResettableGuard(m_aUserEventsMutex); + osl::ResettableMutexGuard aResettableListGuard(m_aUserEventsMutex); if (!m_aUserEvents.empty()) { @@ -90,19 +88,19 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents ) SalUserEvent aEvent( nullptr, nullptr, SalEvent::NONE ); do { - { - osl::MutexGuard aGuard(m_aUserEventsMutex); - aResettableGuard.clear(); - if (m_aProcessingUserEvents.empty() || aCurId != m_aProcessingThread) - break; - aEvent = m_aProcessingUserEvents.front(); - m_aProcessingUserEvents.pop_front(); - } + if (m_aProcessingUserEvents.empty() || aCurId != m_aProcessingThread) + break; + aEvent = m_aProcessingUserEvents.front(); + m_aProcessingUserEvents.pop_front(); + + // remember to reset the guard before break or continue the loop + aResettableListGuard.clear(); if ( !isFrameAlive( aEvent.m_pFrame ) ) { if ( aEvent.m_nEvent == SalEvent::UserEvent ) delete static_cast< ImplSVEvent* >( aEvent.m_pData ); + aResettableListGuard.reset(); continue; } @@ -126,11 +124,11 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents ) SAL_WARN("vcl", "Uncaught exception during DispatchUserEvents!"); std::abort(); } + aResettableListGuard.reset(); if (!bHandleAllCurrentEvents) break; } while( true ); - aResettableGuard.reset(); } if ( !m_bAllUserEventProcessedSignaled && !HasUserEvents() ) |