X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_VTKUtils.cxx;h=569dc023bf68bbd9997b1a26e4158b66f8803046;hb=ce336312be1af7b515cc3471769168b3faaac1af;hp=f4c7e00aea9d743219f37206685fd0d4d0525054;hpb=4592fecfcf7f19fbb7650f63c49947e0ac9b108b;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index f4c7e00ae..569dc023b 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -49,6 +49,8 @@ #include #include +#include + #include #include #include @@ -143,7 +145,8 @@ namespace SMESH for ( int iV = 0; iV < views.count(); ++iV ) { if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) { vtkRenderer *aRenderer = vtkWnd->getRenderer(); - vtkActorCollection *actors = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *actors = aCopy.GetActors(); for (int i = 0; i < actors->GetNumberOfItems(); ++i ) { // size of actors changes inside the loop while (SMESH_Actor *actor = dynamic_cast(actors->GetItemAsObject(i))) @@ -185,10 +188,11 @@ namespace SMESH for ( int iV = 0; iV < views.count(); ++iV ) { if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) { vtkRenderer *aRenderer = vtkWnd->getRenderer(); - vtkActorCollection *actors = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *actors = aCopy.GetActors(); for (int i = 0; i < actors->GetNumberOfItems(); ++i ) { // size of actors changes inside the loop - while(SMESH_Actor *actor = dynamic_cast(actors->GetItemAsObject(i))) + if(SMESH_Actor *actor = dynamic_cast(actors->GetItemAsObject(i))) { vtkWnd->RemoveActor(actor); actor->Delete(); @@ -516,7 +520,8 @@ namespace SMESH { if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(theWindow)){ vtkRenderer *aRenderer = aViewWindow->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()){ if(SMESH_Actor *anActor = dynamic_cast(anAct)){ @@ -645,7 +650,8 @@ namespace SMESH { if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(theWnd)) { vtkRenderer *aRenderer = aViewWindow->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()) if(dynamic_cast(anAct)) @@ -664,7 +670,8 @@ namespace SMESH { OK = true; vtkRenderer *aRenderer = aViewWnd->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); switch (theAction) { @@ -741,7 +748,8 @@ namespace SMESH if( selected.Extent() == 0){ vtkRenderer* aRenderer = aWnd->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()){ if(SMESH_Actor *anActor = dynamic_cast(anAct)){ @@ -841,7 +849,8 @@ namespace SMESH PW); // update actors vtkRenderer* aRenderer = aVtkView->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()){ if(SMESH_Actor *anActor = dynamic_cast(anAct)){ @@ -907,7 +916,8 @@ namespace SMESH void SetPointRepresentation(bool theIsVisible){ if(SVTK_ViewWindow* aViewWindow = GetCurrentVtkView()){ vtkRenderer *aRenderer = aViewWindow->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()){ if(SMESH_Actor *anActor = dynamic_cast(anAct)){ @@ -925,7 +935,8 @@ namespace SMESH if(SVTK_ViewWindow* aWnd = GetCurrentVtkView()){ int anIsAllPickable = (theActor == NULL); vtkRenderer *aRenderer = aWnd->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()){ if(SALOME_Actor *anActor = dynamic_cast(anAct)){ @@ -1135,7 +1146,8 @@ namespace SMESH if( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView() ) { vtkRenderer *aRenderer = aWnd->getRenderer(); - vtkActorCollection *aCollection = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); aCollection->InitTraversal(); while ( vtkActor *anAct = aCollection->GetNextActor())