summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);
}
}