summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2012-08-02 14:17:41 +0200
committerRobert Ancell <robert.ancell@canonical.com>2012-08-02 14:17:41 +0200
commitd7fef7e48e4b39637a59551953198c00ab4137f6 (patch)
tree920cc9c706dbcbf64a5b0a7a00ed8489cb955135 /src
parentf6c926dd1ea0fe9f98430870768f7d24f342e0d6 (diff)
downloadlightdm-d7fef7e48e4b39637a59551953198c00ab4137f6.tar.gz
Correctly reap unused authentication sessions
Diffstat (limited to 'src')
-rw-r--r--src/session.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index 473ef92a..3bf34d6f 100644
--- a/src/session.c
+++ b/src/session.c
@@ -234,6 +234,9 @@ session_watch_cb (GPid pid, gint status, gpointer data)
}
g_signal_emit (G_OBJECT (session), signals[STOPPED], 0);
+
+ /* Drop our reference on the child process, it has terminated */
+ g_object_unref (session);
}
static gboolean
@@ -362,6 +365,11 @@ session_start (Session *session, const gchar *service, const gchar *username, gb
_exit (EXIT_FAILURE);
}
+ /* Hold a reference on this object until the child process terminates so we
+ * can handle the watch callback even if it is no longer used. Otherwise a
+ * zombie process will remain */
+ g_object_ref (session);
+
/* Listen for session termination */
session->priv->authentication_started = TRUE;
session->priv->child_watch = g_child_watch_add (session->priv->pid, session_watch_cb, session);