tdf#152134 Customize: assign user macro to menu hangs

regression from
    commit d4257daba1155ebccbfebea99bad0e4152ca9b08
    Author: Noel Grandin <noelgrandin@gmail.com>
    Date:   Fri Dec 24 20:58:28 2021 +0200
    use comphelper::WeakComponentImplHelper in MenuBarManager

We should not hold the mutex while firing events, since the mutex is now
non-recursive.

Change-Id: I6ee45df0bf27df3ca1fd31857285ceb820161d61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143671
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index eeb1418..4950cbf 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -1347,29 +1347,20 @@ sal_Bool SAL_CALL UIConfigurationManager::isReadOnly()
void UIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
{
    std::unique_lock aGuard(m_mutex);
    comphelper::OInterfaceIteratorHelper4 pIterator( aGuard, m_aConfigListeners );
    while ( pIterator.hasMoreElements() )
    {
        try
    m_aConfigListeners.forEach(aGuard, [&eOp, &aEvent](const css::uno::Reference<XUIConfigurationListener>& l) {
        switch ( eOp )
        {
            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;
            }
            case NotifyOp_Replace:
                l->elementReplaced( aEvent );
                break;
            case NotifyOp_Insert:
                l->elementInserted( aEvent );
                break;
            case NotifyOp_Remove:
                l->elementRemoved( aEvent );
                break;
        }
        catch( const css::uno::RuntimeException& )
        {
            pIterator.remove(aGuard);
        }
    }
    });
}

}