From 4368978e9e79ea0a3c3e35308d7ad48371387d86 Mon Sep 17 00:00:00 2001 From: enk Date: Mon, 19 Jun 2006 09:28:18 +0000 Subject: [PATCH] Fix for Bug PAL12638: SIGSEGV 'segmentation violation' detected. --- src/VISUGUI/VisuGUI_CutPlanesDlg.cxx | 4 +++- src/VISUGUI/VisuGUI_Plot3DDlg.cxx | 17 +++++++++++++---- src/VISUGUI/VisuGUI_Prs3dTools.h | 3 ++- src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 53647c48..78bfc6ac 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -421,7 +421,9 @@ void VisuGUI_CutPlanesPane::deletePlanes() { if (myPreviewActor == 0) return; vtkRenderer* aRend = myPreviewActor->GetRenderer(); - if(aRend) + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + + if(aRend && aWnd) myPreviewActor->RemoveFromRender(aRend); // Bug IPAL11962: preview is still in the viewer, if viewer not active. // if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index 04d78a4e..2ad6cf22 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -362,7 +362,12 @@ void VisuGUI_Plot3DPane::onPrsType(int id) //======================================================================= void VisuGUI_Plot3DPane::updatePreview() { - if (myInitFromPrs || !myPrs || !myViewWindow) + if(myPreviewActor){ + vtkRenderer* aRend = myPreviewActor->GetRenderer(); + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + if (!aWnd) return; + } + if (myInitFromPrs || !myPrs || !myViewWindow) return; bool fitall = false; if (PreviewChkB->isChecked()) // place preview plane @@ -489,14 +494,18 @@ int VisuGUI_Plot3DPane::storeToPrsObject(VISU::Plot3D_i* thePrs) //======================================================================= bool VisuGUI_Plot3DPane::check() { - if (myPreviewActor && myViewWindow) // erase preview - { + if(!myPreviewActor) return true; + + SVTK_ViewWindow* aView; + vtkRenderer* aRend = myPreviewActor->GetRenderer(); + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + if(aRend && aWnd){ myPreviewActor->SetVisibility(false); myViewWindow->RemoveActor(myPreviewActor); myPreviewActor->Delete(); myPreviewActor = 0; } - + return true; } diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 9050d5fd..62b46d51 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -194,12 +194,13 @@ namespace VISU delete aDlg; } else { DeletePrs3d(theModule,aPrs3d,theIO); + QApplication::restoreOverrideCursor(); delete aDlg; return false; } } } - + aViewWindow = GetViewWindow(theModule); // Display created presentation. if (aViewWindow) { PublishInView(theModule, aPrs3d, aViewWindow, /*highlight = */true); diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index affe39ed..6131085e 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -746,7 +746,8 @@ void VisuGUI_ScalarBarPane::deleteScalarBar() if (myPreviewActor == 0) return; vtkRenderer* aRend = myPreviewActor->GetRenderer(); - if(aRend) + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + if(aRend && aWnd) myPreviewActor->RemoveFromRender(aRend); myPreviewActor->GetScalarBar()->VisibilityOff(); myPreviewActor->Delete(); -- 2.39.2