[gdm] session: get rid of the worker_connection state variable in conversation object
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] session: get rid of the worker_connection state variable in conversation object
- Date: Thu, 21 Aug 2014 14:15:46 +0000 (UTC)
commit b5ba458caabde70c865fe5996a1613e7f20dde6e
Author: Ray Strode <rstrode redhat com>
Date: Wed Aug 20 09:23:05 2014 -0400
session: get rid of the worker_connection state variable in conversation object
The conversation object maintains a pointer to the worker connection and
to the worker proxy. The proxy already keeps a reference on the worker
connection, so there's no need to keep an explicit reference on the
connection directly.
This commit drops this extra reference.
https://bugzilla.gnome.org/show_bug.cgi?id=727589
daemon/gdm-session.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index b54f0c1..f40a057 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -66,7 +66,6 @@ typedef struct
GdmSessionWorkerJob *job;
GPid worker_pid;
char *service_name;
- GDBusConnection *worker_connection;
GDBusMethodInvocation *starting_invocation;
char *starting_username;
GDBusMethodInvocation *pending_invocation;
@@ -1057,12 +1056,15 @@ register_worker (GdmDBusWorkerManager *worker_manager_interface,
g_dbus_method_invocation_return_value (invocation, NULL);
- conversation->worker_connection = connection;
conversation->worker_proxy = gdm_dbus_worker_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
GDM_WORKER_DBUS_PATH,
NULL, NULL);
+ /* drop the reference we stole from the pending connections list
+ * since the proxy owns the connection now */
+ g_object_unref (connection);
+
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (conversation->worker_proxy), G_MAXINT);
g_signal_connect (conversation->worker_proxy,
@@ -1840,9 +1842,9 @@ start_conversation (GdmSession *self,
static void
stop_conversation (GdmSessionConversation *conversation)
{
- if (conversation->worker_connection != NULL) {
- g_dbus_connection_close_sync (conversation->worker_connection, NULL, NULL);
- g_clear_object (&conversation->worker_connection);
+ if (conversation->worker_proxy != NULL) {
+ GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY
(conversation->worker_proxy));
+ g_dbus_connection_close_sync (connection, NULL, NULL);
}
conversation->is_stopping = TRUE;
@@ -1854,9 +1856,9 @@ stop_conversation_now (GdmSessionConversation *conversation)
{
g_clear_object (&conversation->worker_manager_interface);
- if (conversation->worker_connection != NULL) {
- g_dbus_connection_close_sync (conversation->worker_connection, NULL, NULL);
- g_clear_object (&conversation->worker_connection);
+ if (conversation->worker_proxy != NULL) {
+ GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY
(conversation->worker_proxy));
+ g_dbus_connection_close_sync (connection, NULL, NULL);
}
gdm_session_worker_job_stop_now (conversation->job);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]