wayland: Avoid NULL slave devices in GdkSeat::get_slaves
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 1 Apr 2016 17:09:03 +0000 (19:09 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Fri, 1 Apr 2016 17:10:36 +0000 (19:10 +0200)
Just because we're asked for a capability, it doesn't mean we have
it.

gdk/wayland/gdkdevice-wayland.c

index 34004baf0b171d7bf4f504772d9317ce2c20de7c..3f2bafedc97ad3f68c806f6345b319e71f4def4d 100644 (file)
@@ -2893,11 +2893,11 @@ gdk_wayland_seat_get_slaves (GdkSeat             *seat,
   GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
   GList *slaves = NULL;
 
-  if (capabilities & GDK_SEAT_CAPABILITY_POINTER)
+  if (wayland_seat->pointer && (capabilities & GDK_SEAT_CAPABILITY_POINTER))
     slaves = g_list_prepend (slaves, wayland_seat->pointer);
-  if (capabilities & GDK_SEAT_CAPABILITY_KEYBOARD)
+  if (wayland_seat->keyboard && (capabilities & GDK_SEAT_CAPABILITY_KEYBOARD))
     slaves = g_list_prepend (slaves, wayland_seat->keyboard);
-  if (capabilities & GDK_SEAT_CAPABILITY_TOUCH)
+  if (wayland_seat->touch && (capabilities & GDK_SEAT_CAPABILITY_TOUCH))
     slaves = g_list_prepend (slaves, wayland_seat->touch);
 
   return slaves;