Blob Blame History Raw
From 199c86579be9f674bdfd53e75a226b7a2d312d31 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 16 Dec 2013 16:57:19 -0500
Subject: [PATCH] slave: fix infinite loop on shutdown

we stop something that calls stop in some circumstances.

This commit breaks the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=712767
---
 daemon/gdm-simple-slave.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index 1fe58bc..d83216b 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -1641,62 +1641,77 @@ gdm_simple_slave_open_reauthentication_channel (GdmSlave             *slave,
                                      g_object_ref (result));
 
                 gdm_session_start_reauthentication (self->priv->session,
                                                     pid_of_caller,
                                                     uid_of_caller);
         }
 
         g_object_unref (result);
 }
 
 static gboolean
 gdm_simple_slave_start (GdmSlave *slave)
 {
         GDM_SLAVE_CLASS (gdm_simple_slave_parent_class)->start (slave);
 
         gdm_simple_slave_run (GDM_SIMPLE_SLAVE (slave));
 
         return TRUE;
 }
 
 static gboolean
 gdm_simple_slave_stop (GdmSlave *slave)
 {
         GdmSimpleSlave *self = GDM_SIMPLE_SLAVE (slave);
 
         g_debug ("GdmSimpleSlave: Stopping simple_slave");
 
         GDM_SLAVE_CLASS (gdm_simple_slave_parent_class)->stop (slave);
 
         if (self->priv->greeter_environment != NULL) {
-                stop_greeter (self);
-                self->priv->greeter_environment = NULL;
+                g_signal_handlers_disconnect_by_func (G_OBJECT (self->priv->greeter_environment),
+                                                      G_CALLBACK (on_greeter_environment_session_opened),
+                                                      self);
+                g_signal_handlers_disconnect_by_func (G_OBJECT (self->priv->greeter_environment),
+                                                      G_CALLBACK (on_greeter_environment_session_started),
+                                                      self);
+                g_signal_handlers_disconnect_by_func (G_OBJECT (self->priv->greeter_environment),
+                                                      G_CALLBACK (on_greeter_environment_session_stopped),
+                                                      self);
+                g_signal_handlers_disconnect_by_func (G_OBJECT (self->priv->greeter_environment),
+                                                      G_CALLBACK (on_greeter_environment_session_exited),
+                                                      self);
+                g_signal_handlers_disconnect_by_func (G_OBJECT (self->priv->greeter_environment),
+                                                      G_CALLBACK (on_greeter_environment_session_died),
+                                                      self);
+                gdm_launch_environment_stop (GDM_LAUNCH_ENVIRONMENT (self->priv->greeter_environment));
+                g_clear_object (&self->priv->greeter_environment);
         }
 
         if (self->priv->start_session_id > 0) {
                 g_source_remove (self->priv->start_session_id);
                 self->priv->start_session_id = 0;
         }
 
         g_clear_pointer (&self->priv->start_session_service_name,
                          (GDestroyNotify) g_free);
 
         if (self->priv->session_is_running) {
                 char *username;
 
                 /* Run the PostSession script. gdmslave suspends until script
                  * has terminated
                  */
                 username = gdm_session_get_username (self->priv->session);
                 if (username != NULL) {
                         gdm_slave_run_script (slave, GDMCONFDIR "/PostSession", username);
                 }
                 g_free (username);
 
 #ifdef  HAVE_LOGINDEVPERM
                 gdm_simple_slave_revoke_console_permissions (self);
 #endif
 
                 self->priv->session_is_running = FALSE;
         }
 
         if (self->priv->session != NULL) {
-- 
1.8.4.2