[mutter] backend: Return NULL cursor renderer if there is no seat



commit ada524265fdcae827d67191b47e4c128c08c9d8f
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Dec 9 11:11:24 2021 +0100

    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>

 src/backends/meta-backend.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 77b99293e1..369b03b1ef 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]