Commit 69048a52 authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri 💬
Browse files

Ensure that the representation is removed from renderer

Disabling the widget ensures that the current renderer is set to nullptr
in vtkAbstractWidget. However, some widgets may still keep their
representation in the renderer. This change ensures that the
representation is removed when the widget is destroyed irrespective of
whether the current renderer is set on the widget.
parent 4b35a245
......@@ -57,9 +57,10 @@ vtkAbstractWidget::~vtkAbstractWidget()
if ( this->WidgetRep )
{
// Remove the representation from the renderer.
if (this->CurrentRenderer)
vtkRenderer* ren = this->WidgetRep->GetRenderer();
if (ren)
{
this->CurrentRenderer->RemoveViewProp(this->WidgetRep);
ren->RemoveViewProp(this->WidgetRep);
}
this->WidgetRep->Delete();
this->WidgetRep = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment