From 1fd6f0dd3af3183c0b41b94eae1379f8e60f3d96 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 7 Oct 2023 17:14:11 +0200 Subject: Fix STR 3458: "GLUT compatibility mode segfaults" ... "when there's no current window". Silently ignore GLUT function calls that need a current window if the current window is NULL, return 0 from functions that return an 'int'. Check if window is shown in Fl_X11_Gl_Window_Driver::swap_buffers(). This would issue "XRequest.nnn: GLXBadDrawable 0x0" on X11 otherwise. Note: the chosen implementation to ignore GLUT calls silently appears to be compatible with GLUT (3.7) whereas FreeGLUT 3.0 would issue error messages and exit. The latter could be implemented as well but would be much more work. --- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx index bbcebbd84..3f09edae2 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx @@ -388,6 +388,8 @@ int Fl_X11_Gl_Window_Driver::mode_(int m, const int *a) { } void Fl_X11_Gl_Window_Driver::swap_buffers() { + if (!fl_xid(pWindow)) // window not shown + return; glXSwapBuffers(fl_display, fl_xid(pWindow)); } -- cgit v1.2.3