summaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/session.c')
-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);