From e7e968722cd7914d3d9a50cb333c1894e91d457f Mon Sep 17 00:00:00 2001 From: enk Date: Mon, 25 Dec 2006 08:37:17 +0000 Subject: [PATCH] Fix for bug IPAL14059: SIGSEGV after clicking "Ok" button of "Change Clipping" dlg after presentation deletion. --- src/VISUGUI/VisuGUI_ClippingDlg.cxx | 21 ++++++++++++++++++++- src/VISUGUI/VisuGUI_ClippingDlg.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 10d90290..cef3b80d 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -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(myVisuGUI)); } @@ -608,7 +609,9 @@ void VisuGUI_ClippingDlg::onSelectionChanged() PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return; - myPrs3d = dynamic_cast(aServant.in()); + VISU::Prs3d_i* aPrs3d = dynamic_cast(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; +} diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.h b/src/VISUGUI/VisuGUI_ClippingDlg.h index be9dcb20..4d8c8977 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.h +++ b/src/VISUGUI/VisuGUI_ClippingDlg.h @@ -136,6 +136,9 @@ public: private: void keyPressEvent( QKeyEvent* e ); + + void SetPrs3d(VISU::Prs3d_i* thePrs); + private: -- 2.39.2