Skip to content

Fix vtkXOpenGLRenderWindow hang in SetSize

David Gobbi requested to merge dgobbi/vtk:resize-x-window into master

In vtkXOpenGLRenderWindow::SetSize() from VTK 9.0 onwards, after XResizeWindow() was called, XIfEvent() was used to wait for the ConfigureNotify that indicated that the resize had occurred. Unfortunately, this would sometimes cause the program to hang indefinitely. This was noticed in particular with, possibly due to race conditions between Qt and VTK.

Hypothetically the hang could occur simply due to the window manager. I found this interesting text from the source code of Tk 8.6, in its WaitForConfigureNotify function:

 * One more tricky detail about this function. In some cases the window
 * manager will decide to ignore a configure request (e.g. because it
 * thinks the window is already in the right place). To avoid hanging in
 * this situation, only wait for a few seconds, then give up.

Following this advice, the new code has a delay loop with a timeout to wait for the ConfigureNotify. Also, it only waits for a ConfigureNotify event if the window manager is involved in the resizing.

Closes #18701 (closed)

Backport: paraview/release
Backport: release

Edited by David Gobbi

Merge request reports