[Libreoffice-commits] core.git: framework/source

Maxim Monastirsky momonasmon at gmail.com
Sun May 14 09:08:23 UTC 2017


 framework/source/uielement/menubarmanager.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit c606bacc58c517c234a03d1c9b25547cc5766f6d
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Thu May 11 17:47:10 2017 +0300

    Allow destroying old MenuBarManager instances
    
    ... after dispatch interception change.
    
    To reproduce:
    
    1. Open the testdoc of tdf#102355
    2. If not under gtk3 - Open several menus or sub menus.
    3. Click the "Intercept" button.
    4. Tools > Customize.. > Menus, make some change, click OK.
    
    Expected that old MenuBarManagers (except the top level) are
    destructed, and new ones are created. Actually the dtors of
    MenuBarManagers from step 2 aren't called (but they will be
    eventually called after closing Writer).
    
    The reason we keep active status listening is mainly for
    Unity's HUD (see my comment in MenuBarManager::Activate).
    But it assumes that Activate was called for all menus,
    which is done by GtkSalMenu at application startup,
    but not after dispatch interception change. Should we fix
    that, or maybe we can just kill this hack (along with
    some related code in GtkSalMenu) anytime soon, given
    that Unity is officially dead?
    
    Change-Id: Ia1cb24391b393e31c98355dc91833c7511a17cda
    Reviewed-on: https://gerrit.libreoffice.org/37589
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 919c77db213a..6ed14c865dc1 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -332,8 +332,17 @@ void SAL_CALL MenuBarManager::frameAction( const FrameActionEvent& Action )
         std::vector< MenuItemHandler* >::iterator p;
         for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p )
         {
-            // Clear dispatch reference as we will requery it later o
+            // Clear dispatch reference as we will requery it later
             MenuItemHandler* pItemHandler = *p;
+
+            if ( pItemHandler->xMenuItemDispatch.is() )
+            {
+                URL aTargetURL;
+                aTargetURL.Complete = pItemHandler->aMenuItemURL;
+                m_xURLTransformer->parseStrict( aTargetURL );
+
+                pItemHandler->xMenuItemDispatch->removeStatusListener( this, aTargetURL );
+            }
             pItemHandler->xMenuItemDispatch.clear();
         }
     }


More information about the Libreoffice-commits mailing list