From ba509d5884e72bfa771e394745689765ca9db20b Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 25 Oct 2011 05:25:25 +0000 Subject: [PATCH] 0021373: [CEA] missing some contextual menu 0021307: EDF PARAVIS: Mismatch in buttons and windows when switching from a component to PARAVIS and back (replace previous fix) --- src/CAM/CAM_Application.cxx | 24 +++++++++++++++++------- src/CAM/CAM_Application.h | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index 8ff235547..7993d9f94 100755 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -45,6 +45,16 @@ #include +class BusyLocker +{ +public: + BusyLocker( bool& busy ) : myPrev( busy ), myBusy( busy ) { myBusy = true; } + ~BusyLocker() { myBusy = myPrev; } +private: + bool myPrev; + bool& myBusy; +}; + /*! \brief Create new instance of CAM_Application. \return new instance of CAM_Application class @@ -82,7 +92,8 @@ extern "C" CAM_EXPORT SUIT_Application* createApplication() CAM_Application::CAM_Application( const bool autoLoad ) : STD_Application(), myModule( 0 ), - myAutoLoad( autoLoad ) + myAutoLoad( autoLoad ), + myBlocked( false ) { readModuleList(); } @@ -368,9 +379,13 @@ CAM_Module* CAM_Application::loadModule( const QString& modName, const bool show */ bool CAM_Application::activateModule( const QString& modName ) { - if ( !modName.isEmpty() && !activeStudy() ) + if ( !modName.isEmpty() && !activeStudy() || myBlocked ) return false; + // VSR 25/10/2011: prevent nested activation/deactivation + // See issues 0021307, 0021373 + BusyLocker lock( myBlocked ); + bool res = false; if ( !modName.isEmpty() ) { @@ -408,15 +423,10 @@ bool CAM_Application::activateModule( CAM_Module* mod ) if ( myModule ) { - // VSR: 26/06/2011 bug 0021307: temporarily disable desktop's signals to prevent false module activation - bool signalsBlocked = desktop() && desktop()->signalsBlocked(); - if ( desktop() ) desktop()->blockSignals( true ); if ( !myModule->deactivateModule( activeStudy() ) ) { // .... } - // VSR: 26/06/2011 bug 0021307: enable desktop's signals back - if ( desktop() ) desktop()->blockSignals( signalsBlocked ); } myModule = mod; diff --git a/src/CAM/CAM_Application.h b/src/CAM/CAM_Application.h index 6471b9730..d56ef88db 100755 --- a/src/CAM/CAM_Application.h +++ b/src/CAM/CAM_Application.h @@ -100,6 +100,7 @@ private: ModuleList myModules; //!< loaded modules list ModuleInfoList myInfoList; //!< modules info list bool myAutoLoad; //!< auto loading flag + bool myBlocked; //!< "blocked" flag, internal usage }; #ifdef WIN32 -- 2.39.2