From: rkv Date: Wed, 27 Nov 2013 13:32:48 +0000 (+0000) Subject: Fix of a crash when module is closed with open SVTK viewer. X-Git-Tag: issue_132_11_28~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=09d469a1bde553d50c63e79d9fb0f77206a0f463;p=modules%2Fhydro.git Fix of a crash when module is closed with open SVTK viewer. --- diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index c7f9eff5..8c413c57 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -166,6 +166,7 @@ bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy ) myObjectStateMap.clear(); myShapesMap.clear(); + myVTKPrsMap.clear(); // clear the data model's list of copying objects HYDROGUI_DataModel::changeCopyingObjects( HYDROData_SequenceOfObjects() ); diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx index 90901235..22912ce3 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx @@ -103,18 +103,22 @@ void HYDROGUI_VTKPrsDisplayer::DeleteScalarBar( const int theViewerId ) SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId ); if( aViewer ) { - SVTK_ViewWindow* aView = dynamic_cast( - aViewer->getViewManager()->getActiveView() ); - if ( aView ) + if ( myScalarBars.contains( (size_t)aViewer ) ) { - if ( myScalarBars.contains( (size_t)aViewer ) ) + SUIT_ViewManager* aViewMgr = dynamic_cast( aViewer->getViewManager() ); + if ( aViewMgr && aViewMgr->getViewsCount() > 0 ) { - vtkScalarBarActor* aScalarBar = myScalarBars[ (size_t)aViewer ]; - if ( aView->getRenderer()->HasViewProp( aScalarBar ) ) + SVTK_ViewWindow* aView = dynamic_cast( aViewMgr->getActiveView() ); + if ( aView ) { - aView->getRenderer()->RemoveActor2D( aScalarBar ); + vtkScalarBarActor* aScalarBar = myScalarBars[ (size_t)aViewer ]; + if ( aView->getRenderer()->HasViewProp( aScalarBar ) ) + { + aView->getRenderer()->RemoveActor2D( aScalarBar ); + } } } + myScalarBars.remove( (size_t)aViewer ); } } }