[gtk+] wayland: Reference pixmap-based cursors' surface before handing the wl_buffer



commit a0abdbbdd6a83db2a51fcd390472f177436b35ca
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 1 18:44:48 2014 +0200

    wayland: Reference pixmap-based cursors' surface before handing the wl_buffer
    
    cairo_surface_destroy() is called after the buffer is released, for every
    wl_buffer. Windows usually reference their cairo surface before rendering,
    so that extra reference is consumed after the buffer is released, so do
    the same with cursor surfaces and add an extra reference whenever a cursor
    surface change is about to be scheduled.
    
    Otherwise, the GdkWaylandCursor is left with an invalid cairo_surface_t,
    which causes crashes the next time it is used.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735830

 gdk/wayland/gdkcursor-wayland.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c
index 6702ce7..b247fad 100644
--- a/gdk/wayland/gdkcursor-wayland.c
+++ b/gdk/wayland/gdkcursor-wayland.c
@@ -179,6 +179,8 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
       *h = wayland_cursor->surface.height / wayland_cursor->surface.scale;
       *scale = wayland_cursor->surface.scale;
 
+      cairo_surface_reference (wayland_cursor->surface.cairo_surface);
+
       if (wayland_cursor->surface.cairo_surface)
         return _gdk_wayland_shm_surface_get_wl_buffer (wayland_cursor->surface.cairo_surface);
       else


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