void VisuGUI_CutLinesDlg::deletePlanes()
{
if (myPreviewActor == 0) return;
- if (SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
- aView->RemoveActor(myPreviewActor);
- aView->RemoveActor(myPreviewActorGlyphs);
- }
+ SVTK_ViewWindow* aView;
+ vtkRenderer* aRend = myPreviewActor->GetRenderer();
+ vtkRenderer* aRendGlyphs = myPreviewActorGlyphs->GetRenderer();
+ if(aRend)
+ myPreviewActor->RemoveFromRender(aRend);
+ if(aRendGlyphs)
+ myPreviewActorGlyphs->RemoveFromRender(aRendGlyphs);
+
+// Bug IPAL11962: preview is still in the viewer, if viewer not active.
+// if (aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
+// aView->RemoveActor(myPreviewActor);
+// aView->RemoveActor(myPreviewActorGlyphs);
+// }
+
myPreviewActor->Delete();
myPreviewActorGlyphs->Delete();
myPreviewActor = 0;