diff options
| author | Matthias Melcher <github@matthiasm.com> | 2025-10-31 20:37:24 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2025-10-31 20:37:24 +0100 |
| commit | 0ac7e427a17764ccdbe22add65a20427ac113294 (patch) | |
| tree | 4f68d6ed637a27b59d226b22b322eaa7212d8d4d /src/Fl_Gl_Window.cxx | |
| parent | 1ba957eb6096c1df1e6476cccea5dbd3ec3b189d (diff) | |
Avoid crash in Fl_Gl_Window::make_current() (#1287)
Diffstat (limited to 'src/Fl_Gl_Window.cxx')
| -rw-r--r-- | src/Fl_Gl_Window.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
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; |
