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
This commit is contained in:
Maxim Monastirsky 2016-11-01 21:46:27 +02:00
parent 8826771e83
commit 2c1d6e5989

View File

@ -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;