summaryrefslogtreecommitdiff
path: root/gtk3-gdk-Clear-GL-context-when-window-is-withdrawn.patch
blob: d7a690b0b70ec231df7eaf5da45aeb06ef565733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 7c2ff0449adfef596d7eea86b51f2ee40c52ad08 Mon Sep 17 00:00:00 2001
From: Andrea Azzarone <azzaronea@gmail.com>
Date: Wed, 18 Oct 2017 12:35:04 +0200
Subject: [PATCH] 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
---
 gdk/gdkwindow.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c0e0a7d4b2b7..79804cdacdac 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -5744,6 +5744,7 @@ gdk_window_withdraw (GdkWindow *window)
 {
   GdkWindowImplClass *impl_class;
   gboolean was_mapped;
+  GdkGLContext *current_context;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -5768,6 +5769,10 @@ gdk_window_withdraw (GdkWindow *window)
 	  _gdk_synthesize_crossing_events_for_geometry_change (window->parent);
 	}
 
+      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);
     }
-- 
2.14.2

bgstack15