]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for bug IPAL14059:
authorenk <enk@opencascade.com>
Mon, 25 Dec 2006 08:37:17 +0000 (08:37 +0000)
committerenk <enk@opencascade.com>
Mon, 25 Dec 2006 08:37:17 +0000 (08:37 +0000)
SIGSEGV after clicking "Ok" button of "Change Clipping" dlg after presentation deletion.

src/VISUGUI/VisuGUI_ClippingDlg.cxx
src/VISUGUI/VisuGUI_ClippingDlg.h

index 10d902909912d77dbd8f61a5169815a63cedadfb..cef3b80db25b360b826af7935b58c0a7455f541a 100644 (file)
@@ -392,6 +392,7 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
 VisuGUI_ClippingDlg::~VisuGUI_ClippingDlg()
 {
   // no need to delete child widgets, Qt does it all for us
+  SetPrs3d(NULL);
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
   VISU::RenderViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI));
 }
@@ -608,7 +609,9 @@ void VisuGUI_ClippingDlg::onSelectionChanged()
     PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
     if (!aServant.in()) return;
 
-    myPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+    VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+    SetPrs3d(aPrs3d);
+
     if (myPrs3d) {
       std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
       myPlanes.clear();
@@ -685,6 +688,10 @@ void VisuGUI_ClippingDlg::onSelectPlane(int theIndex)
 //=================================================================================
 void VisuGUI_ClippingDlg::ClickOnNew()
 {
+  Handle(SALOME_InteractiveObject) anIO;
+  CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO);
+  if (CORBA::is_nil(anObject)) return;
+
   SetCurrentPlaneParam();
   
   if (!myPrs3d)
@@ -1186,3 +1193,15 @@ void VisuGUI_ClippingDlg::keyPressEvent( QKeyEvent* e )
       ClickOnHelp();
     }
 }
+
+void VisuGUI_ClippingDlg::SetPrs3d(VISU::Prs3d_i* thePrs)
+{
+  if(thePrs != myPrs3d){
+    if(myPrs3d)
+      myPrs3d->Destroy();
+    if(thePrs)
+      thePrs->Register();
+    myPrs3d = thePrs;
+  } else 
+    return;
+}
index be9dcb20f035f104cb94922bb322f5b363f4deac..4d8c89779745cce68c8248ff34722678ee766f77 100644 (file)
@@ -136,6 +136,9 @@ public:
 
 private:
     void keyPressEvent( QKeyEvent* e );
+  
+    void SetPrs3d(VISU::Prs3d_i* thePrs);
+  
 
 private: