[bug] Python-vtk BalloonWidget example does not work with vtk 9.2.2

Hello, when I try to run the BalloonWidget example I’ve got a SIGSEV error (it disappears if I comment the EnabledOn() line… but then it is not a very useful example !)

Other examples work well and I have installed vtk 9.2.2 via pip with python 3.10 in a virtual environment.

Do you know what could be the problem ?

EDIT : moving to development as it is more a bug I guess

I can confirm this is a crash in Linux. It works Ok in Windows.

In looking at the debugger it seems to be crashing at line 112 in the function void FireTimers(vtkXRenderWindowInteractor* rwi) in vtkXRenderWindowInteractor.cxx after the first iteration, so it is probably accessing a nonexistent timer (my guess). On line 120: rwi->IsOneShotTimer(timerId) is false which may also be a clue.

I have no idea what is going on. @ben.boeckel any ideas?

@dgobbi? I’m not all that familiar with the X code…

The vtkHoverWidget (parent of vtkBalloonWidget) destroys the timer in its callback, and this results in an invalid iterator during the for loop in vtkXRenderWindowInteractor::FireTimers().

The loop in FireTimers() will have to be rewritten so that it doesn’t iterate over a container whose elements might be deleted during the loop. Should be an easy thing to fix.

See !10155 for a possible fix.

The CI missed this one because it happens only in interactive mode. It is reproducible by running ./bin/vtkInteractionWidgetsCxxTests TestBalloonWidget -I.

@dgobbi’s change fixes the bug.

Thank you for your work ! Do you have an idea of when the fix will be available in python wheels ?

There’s no plan for another 9.2 release at the moment.