summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-12-13 10:17:22 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-12-13 10:17:22 +0100
commit36d34983bb94678c96143e6a7a8538594c588b7d (patch)
tree47bda49d7524eb080d0e799903750509d54c3a69 /src
parent817966f215519f29adf38bcd2da241810190ad5e (diff)
Wayland+GLUT: fix crash in glut_test application - cont'd
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx3
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index ac625fe6f..aec93283b 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -263,6 +263,9 @@ void Fl_Wayland_Gl_Window_Driver::delete_gl_context(GLContext context) {
cached_context = 0;
cached_window = 0;
}
+ if (eglGetCurrentContext() == (EGLContext)context) {
+ eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ }
eglDestroyContext(egl_display, (EGLContext)context);
eglDestroySurface(egl_display, egl_surface);
egl_surface = NULL;
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 9dda9e460..cd98d23a0 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -1279,8 +1279,7 @@ static const struct wl_callback_listener sync_listener = {
static void do_atexit() {
- if (Fl_Wayland_Screen_Driver::wl_display &&
- (!Fl::first_window() || !Fl::first_window()->as_gl_window())) {
+ if (Fl_Wayland_Screen_Driver::wl_display) {
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
}
}