summaryrefslogtreecommitdiff
path: root/daemon/gdm-session.c
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2014-08-20 09:19:01 -0400
committerRay Strode <rstrode@redhat.com>2014-08-21 10:15:11 -0400
commit6532d140652e0537c9eee6fd8226088bf9431726 (patch)
treee307fb833ebedbeb2e3444c78d257a631d224d10 /daemon/gdm-session.c
parent2d414a916d0e45271df8a2d2e0e3886733b6f1bd (diff)
downloadgdm-6532d140652e0537c9eee6fd8226088bf9431726.tar.gz
session: disconnect dbus connection "closed" handler when no longer needed
We temporarily maintain a reference to a dbus connection to the worker process in a linked list, while we wait for the worker to register. If we need to close the connection before the worker registers, then we drop the held reference by way of a "closed" signal handler on the connection object. Once the worker registers, we remove the connection from the linked list, and transfer ownership of the connection to a state variable in the now running conversation object. When performing the reference transfer, we neglect to the disconnect the "closed" handler. This commit makes sure the handler gets disconnected appropriately, so it doesn't get called inappropriately. https://bugzilla.gnome.org/show_bug.cgi?id=727589
Diffstat (limited to 'daemon/gdm-session.c')
-rw-r--r--daemon/gdm-session.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index b2d83c96..b54f0c14 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -996,6 +996,18 @@ allow_worker_function (GDBusAuthObserver *observer,
return FALSE;
}
+static void
+on_worker_connection_closed (GDBusConnection *connection,
+ gboolean remote_peer_vanished,
+ GError *error,
+ GdmSession *self)
+{
+ self->priv->pending_worker_connections =
+ g_list_remove (self->priv->pending_worker_connections,
+ connection);
+ g_object_unref (connection);
+}
+
static gboolean
register_worker (GdmDBusWorkerManager *worker_manager_interface,
GDBusMethodInvocation *invocation,
@@ -1024,6 +1036,10 @@ register_worker (GdmDBusWorkerManager *worker_manager_interface,
g_list_delete_link (self->priv->pending_worker_connections,
connection_node);
+ g_signal_handlers_disconnect_by_func (connection,
+ G_CALLBACK (on_worker_connection_closed),
+ self);
+
credentials = g_dbus_connection_get_peer_credentials (connection);
pid = g_credentials_get_unix_pid (credentials, NULL);
@@ -1130,18 +1146,6 @@ export_worker_manager_interface (GdmSession *self,
NULL);
}
-static void
-on_worker_connection_closed (GDBusConnection *connection,
- gboolean remote_peer_vanished,
- GError *error,
- GdmSession *self)
-{
- self->priv->pending_worker_connections =
- g_list_remove (self->priv->pending_worker_connections,
- connection);
- g_object_unref (connection);
-}
-
static gboolean
handle_connection_from_worker (GDBusServer *server,
GDBusConnection *connection,