summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-08-02 20:15:07 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-08-08 16:17:59 +0200
commitfff5829dc00a1d823aa9bd23430737f82158e484 (patch)
treec6a1be652391cae865949887a1955927b3d51b6a /framework
parent2b22203c0be09e9685cf081f0a1fafa538a21294 (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> (cherry picked from commit 84c4ccfec1cbbd573609623a026a8cd2ad20400f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137963 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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);
}
}