From: san Date: Wed, 21 Dec 2011 13:50:45 +0000 (+0000) Subject: Protection against occasional crashes in SUIT_ViewManager::closeAllViews() - using... X-Git-Tag: V5_1_20~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be4caf97540c29a2eb81d58f1fa8d5069c5a310d;p=modules%2Fgui.git Protection against occasional crashes in SUIT_ViewManager::closeAllViews() - using QObject::deleteLater() instead of operator delete. Protection in SVTK_Renderer destructor against unintentional updates of scene parameters during deletion. --- diff --git a/src/SUIT/SUIT_ViewManager.cxx b/src/SUIT/SUIT_ViewManager.cxx index 4249fa872..dc4d518e2 100755 --- a/src/SUIT/SUIT_ViewManager.cxx +++ b/src/SUIT/SUIT_ViewManager.cxx @@ -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(); } diff --git a/src/SVTK/SVTK_Renderer.cxx b/src/SVTK/SVTK_Renderer.cxx index cab5ca695..37e1eaf65 100644 --- a/src/SVTK/SVTK_Renderer.cxx +++ b/src/SVTK/SVTK_Renderer.cxx @@ -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(); } } diff --git a/src/SVTK/SVTK_Renderer.h b/src/SVTK/SVTK_Renderer.h index 5c24cefa1..02ba4ab3f 100644 --- a/src/SVTK/SVTK_Renderer.h +++ b/src/SVTK/SVTK_Renderer.h @@ -250,6 +250,7 @@ class SVTK_EXPORT SVTK_Renderer : public vtkObject vtkFloatingPointType myTrihedronSize; bool myIsTrihedronRelative; vtkFloatingPointType myBndBox[6]; + bool myIsDestroying; }; #ifdef WIN32