2021-11-09 10:00:59 +00:00
|
|
|
From cbfb3ef99ecc9cbb4e6850e5dd0cc9fb65dd398a Mon Sep 17 00:00:00 2001
|
2020-11-03 11:57:05 +00:00
|
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
|
|
Date: Tue, 1 Sep 2020 13:49:27 -0400
|
2021-11-09 10:00:59 +00:00
|
|
|
Subject: [PATCH 1/3] display: Handle failure before display registration
|
2020-11-03 11:57:05 +00:00
|
|
|
|
|
|
|
Normally, e.g., gdm-wayland-session would register its display
|
|
|
|
before starting the session. This display registration is how
|
|
|
|
the display moves to the "managed" state. We currently detect
|
|
|
|
session failure in gdm_display_unmanage. If gdm-wayland-session
|
|
|
|
is killed before it registers the display, gdm_display_unmanage
|
|
|
|
won't run, and failure won't be detected.
|
|
|
|
|
|
|
|
This commit make gdm_display_unmanage get called, even if the
|
|
|
|
display isn't yet fully managed.
|
|
|
|
---
|
|
|
|
daemon/gdm-display.c | 8 +++-----
|
|
|
|
1 file changed, 3 insertions(+), 5 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
|
2021-11-09 10:00:59 +00:00
|
|
|
index 7c954ad24..3a260923a 100644
|
2020-11-03 11:57:05 +00:00
|
|
|
--- a/daemon/gdm-display.c
|
|
|
|
+++ b/daemon/gdm-display.c
|
2021-11-09 10:00:59 +00:00
|
|
|
@@ -648,62 +648,60 @@ gdm_display_disconnect (GdmDisplay *self)
|
2020-11-03 11:57:05 +00:00
|
|
|
|
|
|
|
/* resource_id_mask is the bits given to each client for
|
|
|
|
* addressing resources */
|
|
|
|
highest_client = (XID) ~unused_bits & ~setup->resource_id_mask;
|
|
|
|
client_increment = setup->resource_id_mask + 1;
|
|
|
|
|
|
|
|
/* Kill every client but ourselves, then close our own connection
|
|
|
|
*/
|
|
|
|
for (client = 0;
|
|
|
|
client <= highest_client;
|
|
|
|
client += client_increment) {
|
|
|
|
|
|
|
|
if (client != setup->resource_id_base)
|
2021-11-09 10:00:59 +00:00
|
|
|
xcb_kill_client (priv->xcb_connection, client);
|
2020-11-03 11:57:05 +00:00
|
|
|
}
|
|
|
|
|
2021-11-09 10:00:59 +00:00
|
|
|
xcb_flush (priv->xcb_connection);
|
2020-11-03 11:57:05 +00:00
|
|
|
|
2021-11-09 10:00:59 +00:00
|
|
|
g_clear_pointer (&priv->xcb_connection, xcb_disconnect);
|
2020-11-03 11:57:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdm_display_unmanage (GdmDisplay *self)
|
|
|
|
{
|
2021-11-09 10:00:59 +00:00
|
|
|
GdmDisplayPrivate *priv;
|
|
|
|
|
2020-11-03 11:57:05 +00:00
|
|
|
g_return_val_if_fail (GDM_IS_DISPLAY (self), FALSE);
|
|
|
|
|
2021-11-09 10:00:59 +00:00
|
|
|
priv = gdm_display_get_instance_private (self);
|
|
|
|
|
2020-11-03 11:57:05 +00:00
|
|
|
- g_debug ("GdmDisplay: unmanage display");
|
|
|
|
-
|
|
|
|
gdm_display_disconnect (self);
|
|
|
|
|
2021-11-09 10:00:59 +00:00
|
|
|
if (priv->user_access_file != NULL) {
|
|
|
|
gdm_display_access_file_close (priv->user_access_file);
|
|
|
|
g_object_unref (priv->user_access_file);
|
|
|
|
priv->user_access_file = NULL;
|
2020-11-03 11:57:05 +00:00
|
|
|
}
|
|
|
|
|
2021-11-09 10:00:59 +00:00
|
|
|
if (priv->access_file != NULL) {
|
|
|
|
gdm_display_access_file_close (priv->access_file);
|
|
|
|
g_object_unref (priv->access_file);
|
|
|
|
priv->access_file = NULL;
|
2020-11-03 11:57:05 +00:00
|
|
|
}
|
|
|
|
|
2021-11-09 10:00:59 +00:00
|
|
|
if (!priv->session_registered) {
|
2020-11-03 11:57:05 +00:00
|
|
|
g_warning ("GdmDisplay: Session never registered, failing");
|
|
|
|
_gdm_display_set_status (self, GDM_DISPLAY_FAILED);
|
|
|
|
} else {
|
|
|
|
_gdm_display_set_status (self, GDM_DISPLAY_UNMANAGED);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdm_display_get_id (GdmDisplay *self,
|
|
|
|
char **id,
|
|
|
|
GError **error)
|
|
|
|
{
|
2021-11-09 10:00:59 +00:00
|
|
|
GdmDisplayPrivate *priv;
|
|
|
|
@@ -1446,63 +1444,63 @@ gdm_display_get_object_skeleton (GdmDisplay *self)
|
2020-11-03 11:57:05 +00:00
|
|
|
{
|
2021-11-09 10:00:59 +00:00
|
|
|
GdmDisplayPrivate *priv;
|
2020-11-03 11:57:05 +00:00
|
|
|
|
2021-11-09 10:00:59 +00:00
|
|
|
priv = gdm_display_get_instance_private (self);
|
|
|
|
return priv->object_skeleton;
|
2020-11-03 11:57:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_launch_environment_session_opened (GdmLaunchEnvironment *launch_environment,
|
|
|
|
GdmDisplay *self)
|
|
|
|
{
|
|
|
|
char *session_id;
|
|
|
|
|
|
|
|
g_debug ("GdmDisplay: Greeter session opened");
|
|
|
|
session_id = gdm_launch_environment_get_session_id (launch_environment);
|
|
|
|
_gdm_display_set_session_id (self, session_id);
|
|
|
|
g_free (session_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_launch_environment_session_started (GdmLaunchEnvironment *launch_environment,
|
|
|
|
GdmDisplay *self)
|
|
|
|
{
|
|
|
|
g_debug ("GdmDisplay: Greeter started");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
self_destruct (GdmDisplay *self)
|
|
|
|
{
|
|
|
|
g_object_ref (self);
|
|
|
|
- if (gdm_display_get_status (self) == GDM_DISPLAY_MANAGED) {
|
|
|
|
- gdm_display_unmanage (self);
|
|
|
|
- }
|
2021-11-09 10:00:59 +00:00
|
|
|
+
|
2020-11-03 11:57:05 +00:00
|
|
|
+ g_debug ("GdmDisplay: initiating display self-destruct");
|
|
|
|
+ gdm_display_unmanage (self);
|
|
|
|
|
|
|
|
if (gdm_display_get_status (self) != GDM_DISPLAY_FINISHED) {
|
|
|
|
queue_finish (self);
|
|
|
|
}
|
|
|
|
g_object_unref (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_launch_environment_session_stopped (GdmLaunchEnvironment *launch_environment,
|
|
|
|
GdmDisplay *self)
|
|
|
|
{
|
|
|
|
g_debug ("GdmDisplay: Greeter stopped");
|
|
|
|
self_destruct (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_launch_environment_session_exited (GdmLaunchEnvironment *launch_environment,
|
|
|
|
int code,
|
|
|
|
GdmDisplay *self)
|
|
|
|
{
|
|
|
|
g_debug ("GdmDisplay: Greeter exited: %d", code);
|
|
|
|
self_destruct (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_launch_environment_session_died (GdmLaunchEnvironment *launch_environment,
|
|
|
|
int signal,
|
|
|
|
GdmDisplay *self)
|
|
|
|
{
|
|
|
|
g_debug ("GdmDisplay: Greeter died: %d", signal);
|
|
|
|
--
|
2021-11-09 10:00:59 +00:00
|
|
|
2.31.1
|
2020-11-03 11:57:05 +00:00
|
|
|
|