g-s-check-acceleration: don't crash on X11 with nested wayland
When running on X11 with a nested wayland (e.g. weston) GDK will default to wayland so looking for X11 atoms will not work (and crash) like:
$ valgrind _build/tools/gnome-session-check-accelerated
==6138== Memcheck, a memory error detector
==6138== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6138== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==6138== Command: _build/tools/gnome-session-check-accelerated
==6138==
==6138== Invalid read of size 8
==6138== at 0x517AD8A: XInternAtom (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6138== by 0x610D28C: gdk_x11_atom_to_xatom_for_display (gdkproperty-x11.c:115)
==6138== by 0x1092DF: main (gnome-session-check-accelerated.c:162)
==6138== Address 0xe8bc6f8 is 1,000 bytes inside a block of size 1,024 free'd
==6138== at 0x4C2DDBB: free (vg_replace_malloc.c:530)
==6138== by 0x4E71A1C: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
==6138== by 0x4E71BBA: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
==6138== by 0x4E71F6A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
==6138== by 0x63C363F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
==6138== by 0x63C9811: g_type_register_static (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
==6138== by 0x63A73C7: g_enum_register_static (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
==6138== by 0x9C7D146: g_bus_type_get_type (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
==6138== by 0x9CAB8A8: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
==6138== by 0x63C71B8: g_type_class_ref (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
==6138== by 0x9CADB18: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
==6138== by 0x9CAE9C6: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
==6138== Block was alloc'd at
==6138== at 0x4C2EBA5: calloc (vg_replace_malloc.c:711)
==6138== by 0x4E89580: g_malloc0 (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
==6138== by 0x4E71957: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
==6138== by 0x4E71BBA: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
==6138== by 0x4E71F6A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
==6138== by 0x63C363F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
==6138== by 0x63C9811: g_type_register_static (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
==6138== by 0x63C9AE4: g_type_register_static_simple (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
==6138== by 0x6135F26: _gdk_wayland_visual_get_type (gdkscreen-wayland.c:706)
==6138== by 0x6135F85: gdk_wayland_visual_new (gdkscreen-wayland.c:813)
==6138== by 0x6135F85: _gdk_wayland_screen_new (gdkscreen-wayland.c:838)
==6138== by 0x61305BE: _gdk_wayland_display_open (gdkdisplay-wayland.c:585)
==6138== by 0x60D3972: gdk_display_manager_open_display (gdkdisplaymanager.c:472)
Skip the check in this case so gnome-session can be tested under these conditions too.
Edited by Guido Günther