[gdm] session: disconnect dbus connection "closed" handler when no longer needed
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] session: disconnect dbus connection "closed" handler when no longer needed
- Date: Thu, 21 Aug 2014 14:15:41 +0000 (UTC)
commit 6532d140652e0537c9eee6fd8226088bf9431726
Author: Ray Strode <rstrode redhat com>
Date: Wed Aug 20 09:19:01 2014 -0400
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
daemon/gdm-session.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index b2d83c9..b54f0c1 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]