backend: Return NULL cursor renderer if there is no seat

During tear down, if anything teared down after the seat tries to get
the cursor renderer, we'd crash trying to get it as the seat would
already be gone. Avoid this by returning NULL when there is no seat.

It's assumed that any path that will happen during tear down that relies
on getting the cursor renderer will gracefully handle it not being
present, e.g. by relying on the cursor rendering cleaning up itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2147>
This commit is contained in:
Jonas Ådahl 2021-12-09 11:11:24 +01:00 committed by Marge Bot
parent c87779f62e
commit ada524265f

View File

@ -1238,6 +1238,9 @@ meta_backend_get_cursor_renderer (MetaBackend *backend)
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterInputDevice *pointer;
if (!priv->default_seat)
return NULL;
pointer = clutter_seat_get_pointer (priv->default_seat);
return meta_backend_get_cursor_renderer_for_device (backend, pointer);