Skip to content

Commit b6c41e5

Browse files
azzar1kenvandine
authored andcommitted
gdk: Clear GL context when window is withdrawn
Some clients (e.g. gnome-online-accounts) quickly unmap and map a window. With some backends the backend surface will be replaced causing the application to crash because the GL context is still using the old surface. Clearing the GL context when a window is withdrawn fixes this. https://bugzilla.gnome.org/show_bug.cgi?id=789141
1 parent 0d82de5 commit b6c41e5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gdk/gdkwindow.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,6 +3903,7 @@ gdk_window_withdraw (GdkWindow *window)
39033903
{
39043904
GdkWindowImplClass *impl_class;
39053905
gboolean was_mapped;
3906+
GdkGLContext *current_context;
39063907

39073908
g_return_if_fail (GDK_IS_WINDOW (window));
39083909

@@ -3925,6 +3926,10 @@ gdk_window_withdraw (GdkWindow *window)
39253926
_gdk_make_event (window, GDK_UNMAP, NULL, FALSE);
39263927
}
39273928

3929+
current_context = gdk_gl_context_get_current ();
3930+
if (current_context != NULL && gdk_gl_context_get_window (current_context) == window)
3931+
gdk_gl_context_clear_current ();
3932+
39283933
recompute_visible_regions (window, FALSE);
39293934
gdk_window_clear_old_updated_area (window);
39303935
}

0 commit comments

Comments
 (0)