GNOME Bugzilla – Bug 770952
wayland: Don't destroy cursor backing storage when the buffer is released
Last modified: 2016-09-08 11:22:21 UTC
.
Created attachment 334911 [details] [review] wayland: Don't destroy cursor backing storage when the buffer is released As per wayland documentation, a client is free to re-use a buffer and its backing storage after it is released by the compositor. This commit changes the wayland cursor cairo_surface destroy logic so that the surface is destroyed together with the cursor object and kept around meanwhile. This fixes a cairo_surface refcount underrun and a virt-manager crash reported in https://bugzilla.redhat.com/show_bug.cgi?id=1373372
Review of attachment 334911 [details] [review]: I don't think this is the correct solution. Before this patch you could set the cursor and get rid of your cairo_surface_t reference without any unexpected side effects, since the wl_surface implicitly had a reference to the cairo surface via the buffer release callback. With this applied, would we destroy the cairo surface would the wl_buffer also be destroyed (see gdk_wayland_cairo_surface_destroy()). You write that the issue is a refcount underrun, did you investigate how the ref count went wrong? For reference, each time one wl_surface.attach(buffer); wl_surface.commit(), we should receive one wl_buffer.release on the attached buffer. Do we cairo_surface_reference() for each time we attach and commit?
After further debugging it turns out that it was mutter's fault for sending too many release events. Jonas fixed that in https://git.gnome.org/browse/mutter/commit/?id=c7976e0dbcd266d788309aabe51392b7de094b32