]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Protection against occasional crashes in SUIT_ViewManager::closeAllViews() - using...
authorsan <san@opencascade.com>
Wed, 21 Dec 2011 13:50:45 +0000 (13:50 +0000)
committersan <san@opencascade.com>
Wed, 21 Dec 2011 13:50:45 +0000 (13:50 +0000)
src/SUIT/SUIT_ViewManager.cxx
src/SVTK/SVTK_Renderer.cxx
src/SVTK/SVTK_Renderer.h

index 4249fa872a1c4e55aa27404eadce654aa9b8a446..dc4d518e25774bb27f26e5089dd30922c412ec47 100755 (executable)
@@ -267,7 +267,7 @@ void SUIT_ViewManager::closeView( SUIT_ViewWindow* theView )
   removeView( view );
 
   if ( view )
-    delete view;
+    view->deleteLater();
 }
 
 /*!Remove view window \a theView from view manager.
@@ -340,7 +340,8 @@ void SUIT_ViewManager::closeAllViews()
 {
   for ( int i = 0; i < myViews.size(); i++ ){
     if( !myViews[i].isNull() )
-      delete myViews[i];
+      myViews[i]->hide();
+      myViews[i]->deleteLater();
   }
   myViews.clear();
 }
index cab5ca695e67649dce67d9cff6276d5d3f4bd29f..37e1eaf650c20ced20884c157eb1fc5ad457720a 100644 (file)
@@ -76,7 +76,8 @@ SVTK_Renderer
   myCubeAxes(SVTK_CubeAxesActor2D::New()),
   myTrihedron(SVTK_Trihedron::New()),
   myTrihedronSize(105),
-  myIsTrihedronRelative(true)
+  myIsTrihedronRelative(true),
+  myIsDestroying(false)
 {
   myDevice->Delete();
   myTransform->Delete();
@@ -157,6 +158,8 @@ SVTK_Renderer
 SVTK_Renderer
 ::~SVTK_Renderer()
 {
+  myIsDestroying = true;
+
   vtkActorCollection* anActors = GetDevice()->GetActors();
   vtkActorCollection* anActors2 = vtkActorCollection::New();
 
@@ -276,7 +279,9 @@ SVTK_Renderer
     anActor->SetHighlightProperty(NULL);
 
     anActor->RemoveFromRender(GetDevice());
-    AdjustActors();
+
+    if ( !myIsDestroying )
+      AdjustActors();
   }
 }
 
index 5c24cefa13b315a4a25202a2deaa174d9bd751c5..02ba4ab3f547c369ee2b461ec665f9d9c5447691 100644 (file)
@@ -250,6 +250,7 @@ class SVTK_EXPORT SVTK_Renderer : public vtkObject
   vtkFloatingPointType myTrihedronSize;
   bool myIsTrihedronRelative;
   vtkFloatingPointType myBndBox[6];
+  bool                 myIsDestroying;
 };
 
 #ifdef WIN32