From ca7d7fc53f0a5f8931d1a17c59de6896ffadc5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 28 Mar 2025 16:31:56 +0100 Subject: [PATCH] wayland: Don't take & drop sprite reference in _update_cursor_surface It's now pointless busy-work, since these functions never own the sprite object anymore. Suggested by Sebastian Wick. Part-of: --- src/wayland/meta-wayland-pointer.c | 8 +++----- src/wayland/meta-wayland-tablet-tool.c | 13 ++++--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index c17d8bc6c..a0d9acf5d 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -1153,16 +1153,14 @@ meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer) if (surface) { - g_autoptr (MetaCursorSprite) cursor_sprite = NULL; + MetaCursorSprite *cursor_sprite = NULL; if (pointer->cursor_surface) { MetaWaylandCursorSurface *cursor_surface = META_WAYLAND_CURSOR_SURFACE (pointer->cursor_surface->role); - MetaCursorSprite *sprite; - sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface); - cursor_sprite = g_object_ref (sprite); + cursor_sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface); } else if (pointer->cursor_shape != META_CURSOR_INVALID) { @@ -1173,7 +1171,7 @@ meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer) cursor_tracker); } - cursor_sprite = g_object_ref (META_CURSOR_SPRITE (pointer->shape_sprite)); + cursor_sprite = META_CURSOR_SPRITE (pointer->shape_sprite); } meta_cursor_tracker_set_window_cursor (cursor_tracker, cursor_sprite); diff --git a/src/wayland/meta-wayland-tablet-tool.c b/src/wayland/meta-wayland-tablet-tool.c index 2ec97df9e..b6a684f2e 100644 --- a/src/wayland/meta-wayland-tablet-tool.c +++ b/src/wayland/meta-wayland-tablet-tool.c @@ -120,7 +120,7 @@ meta_wayland_tablet_tool_update_cursor_surface (MetaWaylandTabletTool *tool) MetaBackend *backend = backend_from_tool (tool); MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend); - g_autoptr (MetaCursorSprite) cursor_sprite = NULL; + MetaCursorSprite *cursor_sprite = NULL; if (tool->cursor_renderer == NULL) return; @@ -132,10 +132,8 @@ meta_wayland_tablet_tool_update_cursor_surface (MetaWaylandTabletTool *tool) { MetaWaylandCursorSurface *cursor_surface = META_WAYLAND_CURSOR_SURFACE (tool->cursor_surface->role); - MetaCursorSprite *sprite; - sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface); - cursor_sprite = g_object_ref (sprite); + cursor_sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface); } else if (tool->cursor_shape != META_CURSOR_INVALID) { @@ -146,15 +144,12 @@ meta_wayland_tablet_tool_update_cursor_surface (MetaWaylandTabletTool *tool) cursor_tracker); } - cursor_sprite = g_object_ref (META_CURSOR_SPRITE (tool->shape_sprite)); + cursor_sprite = META_CURSOR_SPRITE (tool->shape_sprite); } } else if (tool->current_tablet) { - MetaCursorSprite *sprite; - - sprite = META_CURSOR_SPRITE (tool->default_sprite); - cursor_sprite = g_object_ref (sprite); + cursor_sprite = META_CURSOR_SPRITE (tool->default_sprite); } meta_cursor_renderer_set_cursor (tool->cursor_renderer, cursor_sprite);