[gtk+/gtk-3-22] wayland: check valid pending cairo surface



commit 209e01fd91dc8be26997d47fa12b46c880a9ad0b
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed Nov 2 11:51:54 2016 +0100

    wayland: check valid pending cairo surface
    
    gdk_wayland_window_attach_image() is normally called from
    gdk_window_end_paint() to notify the compositor of newly staged drawing.
    
    If any of the drawing code inadvertently dispatches the wayland event
    loop (for instance with a gdk_flush() call), then it's possible that by
    the time gdk_window_end_paint() is called, the staged drawing is already
    destroyed.
    
    This commit bypasses the attach_image call in scenarios where the staged
    drawing is prematurely dropped.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773274

 gdk/wayland/gdkwindow-wayland.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index a8e6785..150a4df 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -904,7 +904,9 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
   cairo_rectangle_int_t rect;
   int i, n;
 
-  if (!window->current_paint.use_gl &&
+  if (impl->staging_cairo_surface &&
+      _gdk_wayland_is_shm_surface (impl->staging_cairo_surface) &&
+      !window->current_paint.use_gl &&
       !cairo_region_is_empty (window->current_paint.region))
     {
       gdk_wayland_window_attach_image (window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]