framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 34 +++------- 1 file changed, 13 insertions(+), 21 deletions(-)
New commits: commit 84c4ccfec1cbbd573609623a026a8cd2ad20400f Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Aug 2 20:15:07 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 3 09:12:16 2022 +0200 tdf#149966 Crash on Windows and freeze on Linux when customizing Menu use the notifyEach helper, which unlocks the mutex while we are calling listeners, which means we can tolerate a re-entrant call to removeConfigurationListener. regression from commit dab35c152af3345786b8335e83cd067b67d08b81 Author: Noel Grandin <noelgran...@gmail.com> Date: Sat Dec 18 20:24:15 2021 +0200 osl::Mutex->std::mutex in ModuleUIConfigurationManager Change-Id: I7a2fbffb1c734b8bd0e952614592ce12c1611328 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137705 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 93058358d04a..ded9d777080c 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -1625,29 +1625,21 @@ sal_Bool SAL_CALL ModuleUIConfigurationManager::isReadOnly() void ModuleUIConfigurationManager::implts_notifyContainerListener( const ui::ConfigurationEvent& aEvent, NotifyOp eOp ) { std::unique_lock aGuard(m_mutex); - comphelper::OInterfaceIteratorHelper4 pIterator( aGuard, m_aConfigListeners ); - while ( pIterator.hasMoreElements() ) + using ListenerMethodType = void (SAL_CALL css::ui::XUIConfigurationListener::*)(const ui::ConfigurationEvent&); + ListenerMethodType aListenerMethod {}; + switch ( eOp ) { - try - { - switch ( eOp ) - { - case NotifyOp_Replace: - pIterator.next()->elementReplaced( aEvent ); - break; - case NotifyOp_Insert: - pIterator.next()->elementInserted( aEvent ); - break; - case NotifyOp_Remove: - pIterator.next()->elementRemoved( aEvent ); - break; - } - } - catch( const css::uno::RuntimeException& ) - { - pIterator.remove(aGuard); - } + case NotifyOp_Replace: + aListenerMethod = &css::ui::XUIConfigurationListener::elementReplaced; + break; + case NotifyOp_Insert: + aListenerMethod = &css::ui::XUIConfigurationListener::elementInserted; + break; + case NotifyOp_Remove: + aListenerMethod = &css::ui::XUIConfigurationListener::elementRemoved; + break; } + m_aConfigListeners.notifyEach(aGuard, aListenerMethod, aEvent); } }