gdm/0001-Clearing-signal-handler-after-udev-settle-or-timeout.patch

80 lines
2.9 KiB
Diff
Raw Normal View History

From 7f5fe3848efe2e6b5a8c5a4fb952990759f3ca59 Mon Sep 17 00:00:00 2001
From: Ghadi Rahme <ghadi.rahme@canonical.com>
Date: Wed, 28 Jun 2023 17:07:12 +0000
Subject: [PATCH] Clearing signal handler after udev settle or timeout to avoid
sudden logout
---
daemon/gdm-local-display-factory.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 471e1b460..c10c1ef6c 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -628,60 +628,61 @@ lookup_prepared_display_by_seat_id (const char *id,
status = gdm_display_get_status (display);
if (status != GDM_DISPLAY_PREPARED)
return FALSE;
return lookup_by_seat_id (id, display, user_data);
}
#ifdef HAVE_UDEV
static gboolean
udev_is_settled (GdmLocalDisplayFactory *factory)
{
g_autoptr (GUdevEnumerator) enumerator = NULL;
GList *devices;
GList *node;
gboolean is_settled = FALSE;
if (factory->seat0_has_platform_graphics) {
g_debug ("GdmLocalDisplayFactory: udev settled, platform graphics enabled.");
return TRUE;
}
if (factory->seat0_has_boot_up_graphics) {
g_debug ("GdmLocalDisplayFactory: udev settled, boot up graphics available.");
return TRUE;
}
if (factory->seat0_graphics_check_timed_out) {
g_debug ("GdmLocalDisplayFactory: udev timed out, proceeding anyway.");
+ g_clear_signal_handler (&factory->uevent_handler_id, factory->gudev_client);
return TRUE;
}
g_debug ("GdmLocalDisplayFactory: Checking if udev has settled enough to support graphics.");
enumerator = g_udev_enumerator_new (factory->gudev_client);
g_udev_enumerator_add_match_name (enumerator, "card*");
g_udev_enumerator_add_match_tag (enumerator, "master-of-seat");
g_udev_enumerator_add_match_subsystem (enumerator, "drm");
devices = g_udev_enumerator_execute (enumerator);
if (!devices) {
g_debug ("GdmLocalDisplayFactory: udev has no candidate graphics devices available yet.");
return FALSE;
}
node = devices;
while (node != NULL) {
GUdevDevice *device = node->data;
GList *next_node = node->next;
g_autoptr (GUdevDevice) platform_device = NULL;
g_autoptr (GUdevDevice) pci_device = NULL;
platform_device = g_udev_device_get_parent_with_subsystem (device, "platform", NULL);
if (platform_device != NULL) {
g_debug ("GdmLocalDisplayFactory: Found embedded platform graphics, proceeding.");
factory->seat0_has_platform_graphics = TRUE;
is_settled = TRUE;
--
2.41.0.rc2