vcl/source/app/salusereventlist.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
New commits: commit 46b1bb4a9c5ca93b33b4fcd2154062676c5059e4 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Sun Apr 7 20:48:24 2019 +0200 Commit: Jan-Marek Glogowski <glo...@fbihome.de> CommitDate: Tue Apr 9 14:43:07 2019 +0200 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 <glo...@fbihome.de> 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() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits