FLTK logo

[master] 0ac7e42 - Avoid crash in Fl_Gl_Window::make_current() (#1287)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
[  All Forums  |  Back to fltk.commit  ]
 
[ Previous Message ] [ Next Message ]

[master] 0ac7e42 - Avoid crash in Fl_Gl_Window::make_current() (#1287) "Matthias Melcher" Oct 31, 2025  
 
commit 0ac7e427a17764ccdbe22add65a20427ac113294
Author:     Matthias Melcher <github@matthiasm.com>
AuthorDate: Fri Oct 31 20:37:24 2025 +0100
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Fri Oct 31 20:37:24 2025 +0100

    Avoid crash in Fl_Gl_Window::make_current() (#1287)

 src/Fl_Gl_Window.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git src/Fl_Gl_Window.cxx src/Fl_Gl_Window.cxx
index b56bd30..d82340d 100644
--- src/Fl_Gl_Window.cxx
+++ 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;
[ Direct Link to Message ]
 
     
[ Previous Message ] [ Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.