After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770402 - wayland/cursor-role: Increase buffer use count on construction
wayland/cursor-role: Increase buffer use count on construction
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-08-25 16:22 UTC by Jonas Ådahl
Modified: 2016-09-01 13:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland/cursor-role: Increase buffer use count on construction (3.13 KB, patch)
2016-08-25 16:22 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2016-08-25 16:22:34 UTC
This fixes a runtime warning that got triggered by Xwayland changing the
pointer cursor.
Comment 1 Jonas Ådahl 2016-08-25 16:22:38 UTC
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.
Comment 2 Rui Matos 2016-08-26 12:33:31 UTC
(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.
Comment 3 Jonas Ådahl 2016-08-26 14:08:08 UTC
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 ...
Comment 4 Rui Matos 2016-08-29 15:17:56 UTC
Review of attachment 334158 [details] [review]:

Ok, still hadn't updated my master branch. Looks good
Comment 5 Jonas Ådahl 2016-09-01 13:00:50 UTC
Attachment 334158 [details] pushed as c7976e0 - wayland/cursor-role: Increase buffer use count on construction