How to Reset VTKDistance Widget/ Distance Representation to make a new measurement in a renderer

Hi I have an app where after pressing a button it enables the vtk distance widget on my renderer. By pressing it again I can turn it off. However, when I press the button again my wiget reappears with the previous measurement.
The code looks something like this (vtkdistance widget is defined in the header → ruler is my distancewidget)
void RenderThread::ruler_on(){

ruler->SetRepresentation(ruler_rep);
ruler->SetCurrentRenderer(renderer_xy());
ruler->SetInteractor(renderer_xy()->GetRenderWindow()->GetInteractor());
ruler->On();
ruler->Render();
renderer_xy->update();

}
void RenderThread::ruler_off(){

ruler->Off();

renderer_xy->update();

}

I have tried deleting the representation and other strategies but they are not working. The problem is similar to this thread Select and delete a widget but the answer is not clear to me