summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-11-01 21:46:27 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2016-11-01 21:53:11 +0200
commit2c1d6e598908dae527a7cfeed8e82b23fedd04da (patch)
treea76d3dd43abefcd6b39cfae1b9dadd13e68615ee
parent8826771e8398063018935c38039c05faf4c993a3 (diff)
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
-rw-r--r--sfx2/source/sidebar/ControllerFactory.cxx6
1 files 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<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;