From: jfa Date: Thu, 1 Jun 2006 10:40:30 +0000 (+0000) Subject: PAL12486: SIGSEGV when closing a study. Nullify member myApp of module to suppress... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_DEBUG_3_2_0b1;p=modules%2Fgui.git PAL12486: SIGSEGV when closing a study. Nullify member myApp of module to suppress invalid pointer usage. --- diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index 1a6852fed..9b37b3347 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -26,6 +26,9 @@ #include #include +#include +#include + /*!Icon.*/ static const char* ModuleIcon[] = { "20 20 2 1", @@ -84,6 +87,11 @@ CAM_Module::~CAM_Module() void CAM_Module::initialize( CAM_Application* app ) { myApp = app; + if (myApp) { + SUIT_Session* aSession = SUIT_Session::session(); + connect(aSession, SIGNAL( applicationClosed( SUIT_Application* ) ), + this, SLOT( onApplicationClosed( SUIT_Application* ) )); + } } /*!\retval Module icon.*/ @@ -159,6 +167,13 @@ void CAM_Module::studyChanged( SUIT_Study* , SUIT_Study* ) { } +/*!Public slot, nullify application pointer if the application was closed.*/ +void CAM_Module::onApplicationClosed( SUIT_Application* theApp ) +{ + if (myApp == theApp) + myApp = NULL; +} + /*!Create and return new instance of CAM_DataModel.*/ CAM_DataModel* CAM_Module::createDataModel() { diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h index 3976a197b..3409905e7 100755 --- a/src/CAM/CAM_Module.h +++ b/src/CAM/CAM_Module.h @@ -28,6 +28,7 @@ class QAction; class SUIT_Study; +class SUIT_Application; class CAM_Study; class CAM_DataModel; class CAM_Application; @@ -86,6 +87,8 @@ public slots: virtual void studyClosed( SUIT_Study* ); virtual void studyChanged( SUIT_Study*, SUIT_Study* ); + virtual void onApplicationClosed( SUIT_Application* ); + protected: virtual CAM_DataModel* createDataModel();