From: vsv Date: Tue, 9 Jun 2020 14:49:43 +0000 (+0300) Subject: Avoid ciclik call of addModule() method on activation of Shaper module X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a1c9fc93b94bb6ec26476b347f55479def13118a;p=modules%2Fgui.git Avoid ciclik call of addModule() method on activation of Shaper module --- diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index 9612c4e4d..aeabb7a47 100644 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -417,6 +417,7 @@ bool CAM_Application::activateModule( const QString& modName ) bool res = false; if ( !modName.isEmpty() ) { + myActvatingModule = modName; CAM_Module* mod = module( modName ); if ( !mod ) mod = loadModule( modName ); @@ -424,6 +425,7 @@ bool CAM_Application::activateModule( const QString& modName ) if ( mod ) res = activateModule( mod ); + myActvatingModule = QString(); } else res = activateModule( 0 ); diff --git a/src/CAM/CAM_Application.h b/src/CAM/CAM_Application.h index b0b69d3f6..0dae7d11f 100644 --- a/src/CAM/CAM_Application.h +++ b/src/CAM/CAM_Application.h @@ -94,6 +94,8 @@ protected: virtual bool abortAllOperations(); + QString actvatingModule() const { return myActvatingModule; } + private: void readModuleList(); @@ -111,6 +113,7 @@ private: static ModuleInfoList myInfoList; //!< modules info list bool myAutoLoad; //!< auto loading flag bool myBlocked; //!< "blocked" flag, internal usage + QString myActvatingModule; //!< Name of currently activating module. }; #ifdef WIN32 diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index baf53032e..14a63145c 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -4958,20 +4958,24 @@ void LightApp_Application::onDesktopMessage( const QString& message ) } else if ( message.toLower().startsWith("register_module_in_study" ) ) { QString moduleName = message.split( sectionSeparator ).last(); - CAM_Module* mod = module( moduleName ); - if ( !mod ) - mod = module( moduleTitle( moduleName ) ); - if ( !mod ) { - mod = loadModule( moduleName ); - if ( !mod ) - mod = loadModule( moduleTitle( moduleName) ); - if ( mod ) { + // Check name of current activating module name in order to avoid ciclik + // call because of messages + if (actvatingModule().isNull()) { + CAM_Module* mod = module(moduleName); + if (!mod) + mod = module(moduleTitle(moduleName)); + if (!mod) { + mod = loadModule(moduleName); + if (!mod) + mod = loadModule(moduleTitle(moduleName)); + if (mod) { addModule(mod); CAM_Study* anActiveStudy = dynamic_cast(activeStudy()); if (anActiveStudy) mod->connectToStudy(anActiveStudy); } - } + } + } } else { QStringList data = message.split( sectionSeparator );