From 2c1d6e598908dae527a7cfeed8e82b23fedd04da Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Tue, 1 Nov 2016 21:46:27 +0200 Subject: 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 --- sfx2/source/sidebar/ControllerFactory.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index 7de15515b482..085a8ccfe5f0 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -53,8 +53,10 @@ Reference 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(::framework::CreateToolBoxController( @@ -78,7 +80,7 @@ Reference ControllerFactory::CreateToolBoxController( // Initialize the controller with eg a service factory. Reference xInitialization (xController, UNO_QUERY); - if (xInitialization.is()) + if (!bFactoryHasController && xInitialization.is()) { beans::PropertyValue aPropValue; std::vector aPropertyVector; -- cgit