Skip to content

Commit

Permalink
gdk: Clear GL context when window is withdrawn
Browse files Browse the repository at this point in the history
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
  • Loading branch information
azzar1 authored and kenvandine committed Oct 25, 2017
1 parent 0d82de5 commit b6c41e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gdk/gdkwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -3903,6 +3903,7 @@ gdk_window_withdraw (GdkWindow *window)
{
GdkWindowImplClass *impl_class;
gboolean was_mapped;
GdkGLContext *current_context;

g_return_if_fail (GDK_IS_WINDOW (window));

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

current_context = gdk_gl_context_get_current ();
if (current_context != NULL && gdk_gl_context_get_window (current_context) == window)
gdk_gl_context_clear_current ();

recompute_visible_regions (window, FALSE);
gdk_window_clear_old_updated_area (window);
}
Expand Down

0 comments on commit b6c41e5

Please sign in to comment.