]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
PAL12486: SIGSEGV when closing a study. Nullify member myApp of module to suppress... BR_DEBUG_3_2_0b1
authorjfa <jfa@opencascade.com>
Thu, 1 Jun 2006 10:40:30 +0000 (10:40 +0000)
committerjfa <jfa@opencascade.com>
Thu, 1 Jun 2006 10:40:30 +0000 (10:40 +0000)
src/CAM/CAM_Module.cxx
src/CAM/CAM_Module.h

index 1a6852fed6b60c8f4171b0239933c1006662d2da..9b37b334795b8786ddfe0982a41c59ea0199193e 100755 (executable)
@@ -26,6 +26,9 @@
 #include <QtxActionMenuMgr.h>
 #include <QtxActionToolMgr.h>
 
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
+
 /*!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()
 { 
index 3976a197b863ef8eec9aa3687cb73e800f69c205..3409905e764e985401eb90cee97e9d4362754677 100755 (executable)
@@ -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();