diff --git a/src/core/meta-cursor-tracker-private.h b/src/core/meta-cursor-tracker-private.h index f236b3494..ef8de4b98 100644 --- a/src/core/meta-cursor-tracker-private.h +++ b/src/core/meta-cursor-tracker-private.h @@ -86,7 +86,7 @@ void meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker, MetaCursorReference *cursor); void meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker); void meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker, - MetaCursor cursor); + MetaCursorReference *cursor); void meta_cursor_tracker_update_position (MetaCursorTracker *tracker, int new_x, diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c index a5ceb2e72..9e05edbb0 100644 --- a/src/core/meta-cursor-tracker.c +++ b/src/core/meta-cursor-tracker.c @@ -396,11 +396,12 @@ meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker) } void -meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker, - MetaCursor cursor) +meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker, + MetaCursorReference *cursor) { g_clear_pointer (&tracker->root_cursor, meta_cursor_reference_unref); - tracker->root_cursor = meta_cursor_reference_from_theme (tracker, cursor); + if (cursor) + tracker->root_cursor = meta_cursor_reference_ref (cursor); sync_cursor (tracker); } diff --git a/src/core/screen.c b/src/core/screen.c index 38f8da8c7..030bab78c 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1387,8 +1387,11 @@ meta_screen_update_cursor (MetaScreen *screen) MetaDisplay *display = screen->display; MetaCursor cursor = screen->current_cursor; Cursor xcursor; + MetaCursorReference *cursor_ref; - meta_cursor_tracker_set_root_cursor (screen->cursor_tracker, cursor); + cursor_ref = meta_cursor_reference_from_theme (screen->cursor_tracker, cursor); + meta_cursor_tracker_set_root_cursor (screen->cursor_tracker, cursor_ref); + meta_cursor_reference_unref (cursor_ref); /* Set a cursor for X11 applications that don't specify their own */ xcursor = meta_display_create_x_cursor (display, cursor);