Salome HOME
Fix for bug IPAL9258(/dn06/../current1706): SIGSEGV after trying to close dialog...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_CreatePatternDlg.cxx
index 28bb9ad0c5e05707628d1398d5994fee150ab6d1..6b1f20e1287f6a4d3fcc29085ff6ff2aab22c77c 100755 (executable)
@@ -88,9 +88,7 @@ SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI*   theModule,
      : QDialog( SMESH::GetDesktop( theModule ), theName, false,\r
                 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),\r
      mySMESHGUI( theModule ),\r
-     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),\r
-     myViewWindow( SMESH::GetViewWindow( theModule ) ),\r
-     mySelector( myViewWindow->GetSelector() )\r
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )\r
 {\r
   setCaption(tr("CAPTION"));\r
 \r
@@ -104,6 +102,9 @@ SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI*   theModule,
 \r
   aDlgLay->setStretchFactor(aMainFrame, 1);\r
 \r
+  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))\r
+    mySelector = aViewWindow->GetSelector();\r
+\r
   Init(theType);\r
 }\r
 \r
@@ -386,7 +387,8 @@ void SMESHGUI_CreatePatternDlg::onSave()
                                tr("ERROR_OF_SAVING"), QMessageBox::Ok);\r
     } else {\r
       //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
-      myViewWindow->SetSelectionMode(ActorSelection);\r
+      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))\r
+       aViewWindow->SetSelectionMode(ActorSelection);\r
       disconnect(mySelectionMgr, 0, this, 0);\r
       disconnect(mySMESHGUI, 0, this, 0);\r
       mySMESHGUI->ResetState();\r
@@ -435,7 +437,8 @@ void SMESHGUI_CreatePatternDlg::onOk()
       return;\r
     } else {\r
       //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
-      myViewWindow->SetSelectionMode(ActorSelection);\r
+      if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))\r
+       aViewWindow->SetSelectionMode(ActorSelection);\r
       disconnect(mySelectionMgr, 0, this, 0);\r
       disconnect(mySMESHGUI, 0, this, 0);\r
       mySMESHGUI->ResetState();\r
@@ -454,7 +457,8 @@ void SMESHGUI_CreatePatternDlg::onOk()
 //=======================================================================\r
 void SMESHGUI_CreatePatternDlg::onClose()\r
 {\r
-  myViewWindow->SetSelectionMode(ActorSelection);\r
+  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))\r
+    aViewWindow->SetSelectionMode(ActorSelection);\r
   disconnect(mySelectionMgr, 0, this, 0);\r
   disconnect(mySMESHGUI, 0, this, 0);\r
   mySMESHGUI->ResetState();\r
@@ -682,7 +686,8 @@ void SMESHGUI_CreatePatternDlg::activateSelection()
 {\r
   mySelectionMgr->clearFilters();\r
   //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
-  myViewWindow->SetSelectionMode(ActorSelection);\r
+  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))\r
+    aViewWindow->SetSelectionMode(ActorSelection);\r
 \r
   if (myType == Type_2d) {\r
     mySelectionMgr->installFilter(new SMESH_NumberFilter\r