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
This commit is contained in:
Carlos Garnacho
2014-09-01 18:44:48 +02:00
parent b2b948514e
commit a0abdbbdd6

View File

@ -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