From 0ac7e427a17764ccdbe22add65a20427ac113294 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 31 Oct 2025 20:37:24 +0100 Subject: Avoid crash in Fl_Gl_Window::make_current() (#1287) --- src/Fl_Gl_Window.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index b56bd30f9..d82340de4 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -118,6 +118,10 @@ int Fl_Gl_Window::mode(int m, const int *a) { void Fl_Gl_Window::make_current() { // puts("Fl_Gl_Window::make_current()"); // printf("make_current: context_=%p\n", context_); + // The following line prevents potential crashes when make_current() is + // called before show(). Applications should call show() before + // make_current() for proper initialization. + if (!shown()) return; pGlWindowDriver->make_current_before(); if (!context_) { mode_ &= ~NON_LOCAL_CONTEXT; -- cgit v1.2.3