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

Maxim Monastirsky momonasmon at gmail.com
Tue Nov 1 19:55:32 UTC 2016


 sfx2/source/sidebar/ControllerFactory.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 2c1d6e598908dae527a7cfeed8e82b23fedd04da
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue Nov 1 21:46:27 2016 +0200

    tdf#103624 Avoid double init of controls in SidebarToolBox
    
    Controls that created by the service manager are already
    initialized by it. At least in the case of SaveToolbarController
    such double init creates a problem, as SaveToolbarController
    will add itself as a modify listener twice, but remove only
    once in dispose method. Probably SaveToolbarController should
    be smarter about this, for both not adding a listener twice,
    and also not attempt to work after being disposed - but that
    doesn't make the behavior of SidebarToolBox correct.
    
    Change-Id: I3f0fcdff31c65198a2233c969d37a0015712fff5

diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx
index 7de1551..085a8cc 100644
--- a/sfx2/source/sidebar/ControllerFactory.cxx
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -53,8 +53,10 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
             rxFrame, rxController,
             nWidth));
 
+    bool bFactoryHasController( xController.is() );
+
     // Create a controller for the new item.
-    if ( ! xController.is())
+    if ( !bFactoryHasController )
     {
         xController.set(
             static_cast<XWeak*>(::framework::CreateToolBoxController(
@@ -78,7 +80,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
 
     // Initialize the controller with eg a service factory.
     Reference<lang::XInitialization> xInitialization (xController, UNO_QUERY);
-    if (xInitialization.is())
+    if (!bFactoryHasController && xInitialization.is())
     {
         beans::PropertyValue aPropValue;
         std::vector<Any> aPropertyVector;


More information about the Libreoffice-commits mailing list