summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-08-02 20:15:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-03 09:12:16 +0200
commit84c4ccfec1cbbd573609623a026a8cd2ad20400f (patch)
treecbf58de1989938b757e3e15f7ce4665c3ce37ff3 /framework
parentba62400222232b49d034f6b0a51e0679d0729d10 (diff)
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 <noelgrandin@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.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx34
1 files changed, 13 insertions, 21 deletions
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);
}
}