]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Fix of a crash when module is closed with open SVTK viewer.
authorrkv <rkv@opencascade.com>
Wed, 27 Nov 2013 13:32:48 +0000 (13:32 +0000)
committerrkv <rkv@opencascade.com>
Wed, 27 Nov 2013 13:32:48 +0000 (13:32 +0000)
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx

index c7f9eff53515debda29984d15081a58e1dc05cb5..8c413c578dadaab5aca8693882eff4d684580e52 100644 (file)
@@ -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() );
index 909012353d23fffc6ad6de8103e0a11e6de9a561..22912ce372de41eb7ad5ff7359aa97236bc01e1c 100644 (file)
@@ -103,18 +103,22 @@ void HYDROGUI_VTKPrsDisplayer::DeleteScalarBar( const int theViewerId )
   SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
   if( aViewer )
   {
-    SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(
-      aViewer->getViewManager()->getActiveView() );
-    if ( aView )
+    if ( myScalarBars.contains( (size_t)aViewer ) )
     {
-      if ( myScalarBars.contains( (size_t)aViewer ) )
+      SUIT_ViewManager* aViewMgr = dynamic_cast<SUIT_ViewManager*>( aViewer->getViewManager() );
+      if ( aViewMgr && aViewMgr->getViewsCount() > 0 )
       {
-        vtkScalarBarActor* aScalarBar = myScalarBars[ (size_t)aViewer ];
-        if ( aView->getRenderer()->HasViewProp( aScalarBar ) )
+        SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>( 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 );
     }
   }
 }