GNOME Bugzilla – Bug 770402
wayland/cursor-role: Increase buffer use count on construction
Last modified: 2016-09-01 13:00:54 UTC
This fixes a runtime warning that got triggered by Xwayland changing the pointer cursor.
Created attachment 334158 [details] [review] wayland/cursor-role: Increase buffer use count on construction We may be assigned multiple times, if the surface is assigned to be a cursor surface multiple times. Each time e.g. wl_pointer.set_cursor is called, we'll be assigned. While the role object exists, we'll handle buffer use count even when we are not actively assigned, thus we should only handle the initial assignment use count bump when constructing, so that we don't increase it when reassigned, where the wl_resource may already have been released.
(In reply to Jonas Ådahl from comment #1) > Created attachment 334158 [details] [review] [review] > wayland/cursor-role: Increase buffer use count on construction > > We may be assigned multiple times, if the surface is assigned to be a > cursor surface multiple times. Each time e.g. wl_pointer.set_cursor is > called, we'll be assigned. > > While the role object exists, we'll handle buffer use count even when > we are not actively assigned, This is confusing, are we re-assigned or not? I don't see how cursor_surface_row_assigned() gets called more than once.
We started doing that in this commit: https://git.gnome.org/browse/mutter/commit/?id=a5efa30f6c73ddb3c8a8601d908b6068a3bc6d19 I.e. surface = wl_compositor.create_surface(); xdg_surface1 = xdg_shell.get_xdg_surface(surface); xdg_toplevel1 = xdg_surface1.get_toplevel(); ... constructed and assigned the first time ... xdg_toplevel1.destroy(); xdg_surface1.destroy(); xdg_surface2 = xdg_shell.get_xdg_surface(surface); xdg_toplevel2 = xdg_surface2.get_toplevel(); ... not constructed (using the old role instance), but assigned again ...
Review of attachment 334158 [details] [review]: Ok, still hadn't updated my master branch. Looks good
Attachment 334158 [details] pushed as c7976e0 - wayland/cursor-role: Increase buffer use count on construction