@@ -2721,28 +2721,35 @@ ToolOptions::~ToolOptions() {}
27212721
27222722void ToolOptions::showEvent (QShowEvent *) {
27232723 TTool::Application *app = TTool::getApplication ();
2724- ToolHandle *currTool = app->getCurrentTool ();
2725- if (currTool) {
2724+
2725+ if (ToolHandle *currTool = app->getCurrentTool ())
2726+ currTool->disconnect (this );
2727+ if (TObjectHandle *currObject = app->getCurrentObject ())
2728+ currObject->disconnect (this );
2729+ if (TXshLevelHandle *currLevel = app->getCurrentLevel ())
2730+ currLevel->disconnect (this );
2731+
2732+ if (ToolHandle *currTool = app->getCurrentTool ()) {
2733+ currTool->disconnect (this );
27262734 onToolSwitched ();
27272735 connect (currTool, SIGNAL (toolSwitched ()), SLOT (onToolSwitched ()));
27282736 connect (currTool, SIGNAL (toolOptionsBoxChanged ()),
27292737 SLOT (onToolOptionsBoxChanged ()));
27302738 connect (currTool, SIGNAL (toolChanged ()), SLOT (onToolChanged ()));
27312739 }
27322740
2733- TObjectHandle *currObject = app->getCurrentObject ();
2734- if ( currObject) {
2741+ if ( TObjectHandle *currObject = app->getCurrentObject ()) {
2742+ currObject-> disconnect ( this );
27352743 onStageObjectChange ();
27362744 connect (currObject, SIGNAL (objectSwitched ()), SLOT (onStageObjectChange ()));
27372745 connect (currObject, SIGNAL (objectChanged (bool )),
27382746 SLOT (onStageObjectChange ()));
27392747 }
27402748
2741- TXshLevelHandle *currLevel = app->getCurrentLevel ();
2742-
2743- if (currLevel)
2749+ if (TXshLevelHandle *currLevel = app->getCurrentLevel ()) {
27442750 connect (currLevel, SIGNAL (xshLevelSwitched (TXshLevel *)), this ,
27452751 SLOT (onStageObjectChange ()));
2752+ }
27462753}
27472754
27482755// -----------------------------------------------------------------------------
0 commit comments