Crash related to vtkRenderWindow::SetOffScreenRendering
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
There is a crash in VTK 6 that seems related to setting off-screen rendering to On, and then to Off again. This is a simple failing test case:
def test_off_screen_rendering_bug(): import vtk renderer = vtk.vtkRenderer() render_window = vtk.vtkRenderWindow() render_window.AddRenderer(renderer) render_window.Render() render_window.SetOffScreenRendering(True) render_window.SetOffScreenRendering(False) # <-- Problem happens here assert render_window.GetRenderers().GetFirstRenderer().GetRenderWindow() is not None render_window.Render() # <-- Crashes here if the assert above is commented out.
The RenderWindow pointer of the renderers are being set to NULL in the
Note: this is only happening when the attribute OffScreenUseFrameBuffer is 0, because SetOffScreenRendering is invoking CleanUpOffScreenRendering, which is invoking CleanUpRenderers, which sets the RenderWindow to NULL and then it is never attributed back to a valid value (because ContextId is also set to 0, and ResumeScreenRendering only restores the RenderWindow when ContextId != 0). OffScreenUseFrameBuffer is kept as 0 when CreateHardwareOffScreenWindow fails (probably because OpenGL framebuffer extension is also disabled). So, in order to really reproduce this, the framebuffer must be disabled (using remote desktop connection seems to do this).
This used to work on older versions, so I've tried to trace what changes led to this problem, and I got these commits:
Authored by: Clinton Stimpson 7 years ago ENH: Don't leave the vtkRenderer's RenderWindow NULL after reparenting the vtkRenderWindow. Making modifications (add/remove 3D widgets) before the next render would lead to crashes.
Authored by: Burlen Loring 2 years ago OpenGL error hunt This patch implements OpenGL error checking in VTK. (...)
Authored by: Utkarsh Ayachit 2 years ago Fixed regression introduced by a6fa3e37.