From 8ace3710d83025a4b9d857072b5c1df2e7287880 Mon Sep 17 00:00:00 2001 From: asv Date: Tue, 14 Jun 2005 12:38:09 +0000 Subject: [PATCH] bug fix: change of display mode of VTK viewer throws SIGSEGV. --- src/DisplayGUI/DisplayGUI.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 7ceed3f63..94400653a 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -43,6 +43,8 @@ #include +#include +#include #include #include #include @@ -416,22 +418,23 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow SALOME_ListIO aList; if ( viewWindow->getViewManager()->getType() == VTKViewer_Viewer::Type() ) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewWindow*)viewWindow)->getRWInteractor(); + SVTK_ViewWindow* vw = dynamic_cast( viewWindow ); + SVTK_RenderWindowInteractor* rwi = vw->getRWInteractor(); aSelMgr->selectedObjects( aList ); SALOME_ListIteratorOfListIO It( aList ); for( ;It.More(); It.Next() ) { - SVTK_Viewer* stvkViewer = (SVTK_Viewer*)(viewWindow->getViewManager()->getViewModel()); + SVTK_Viewer* stvkViewer = (SVTK_Viewer*)(vw->getViewManager()->getViewModel()); SVTK_Prs* vtkPrs = dynamic_cast( stvkViewer->CreatePrs( It.Value()->getEntry() ) ); if ( vtkPrs && !vtkPrs->IsNull() ) { if ( mode == 0 ) - myRenderInter->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); + rwi->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); else if ( mode == 1 ) - myRenderInter->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); + rwi->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); } } - myRenderInter->Render(); + rwi->Render(); } else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();