[gdm/fix-crash-when-doomed: 10/10] local-display-factory: Don't crash if Xorg and Wayland are both unavailable




commit 8c03f26dcd0e37fc8fd4fa567b6e60864d694c3e
Author: Ray Strode <rstrode redhat com>
Date:   Thu Oct 7 15:34:27 2021 -0400

    local-display-factory: Don't crash if Xorg and Wayland are both unavailable
    
    At the moment if Wayland doesn't work, the login screen will fall back
    to Xorg, and if Xorg doesn't work the login screen will fall back to
    Wayland.
    
    But if the fall back choice is disabled explicitly, GDM will just crash.
    
    This commit fixes the crash.
    
    Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/739

 daemon/gdm-local-display-factory.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 5fbbad68f..c00e1c47d 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -684,8 +684,13 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory,
                 falling_back = factory->num_failures > 0;
                 session_types = gdm_local_display_factory_get_session_types (factory, falling_back);
 
-                g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use %s%s",
-                         session_types[0], falling_back? " fallback" : "");
+                if (session_types == NULL) {
+                        g_debug ("GdmLocalDisplayFactory: Both Wayland and Xorg are unavailable");
+                        seat_supports_graphics = FALSE;
+                } else {
+                        g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use %s%s",
+                                 session_types[0], falling_back? " fallback" : "");
+                }
         } else {
                 is_seat0 = FALSE;
 


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