summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2018-05-09 15:43:27 +0100
committerRay Strode <rstrode@redhat.com>2018-05-14 14:34:33 -0400
commit280e12f7f3cb2d7ccdc8fd2ef08907335b9e2f2b (patch)
tree9591586795c93c7e34e60a3e6157ba7b1c6485c5
parent0359808fa7bdca67451d049b2517b91b3c8dd006 (diff)
downloadgdm-280e12f7f3cb2d7ccdc8fd2ef08907335b9e2f2b.tar.gz
client: add weak pointer for connection object
At the moment we fail to nullify GdmClient's connection to GDM when the connection is disposed. This commit adds a weak pointer to correct that mistake. https://bugzilla.gnome.org/show_bug.cgi?id=795940
-rw-r--r--libgdm/gdm-client.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index c017bf86..b5f35306 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -460,6 +460,10 @@ gdm_client_open_connection_sync (GdmClient *client,
g_clear_pointer (&client->priv->address, g_free);
goto out;
}
+
+ g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
+ (gpointer *)
+ &client->priv->connection);
} else {
client->priv->connection = g_object_ref (client->priv->connection);
}
@@ -583,6 +587,8 @@ gdm_client_open_connection_finish (GdmClient *client,
if (client->priv->connection == NULL) {
client->priv->connection = g_steal_pointer (&connection);
+ g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
+ (gpointer *) &client->priv->connection);
} else if (client->priv->connection == connection) {
connection = NULL;
}
@@ -1616,6 +1622,12 @@ gdm_client_finalize (GObject *object)
&client->priv->chooser);
}
+ if (client->priv->connection != NULL) {
+ g_object_remove_weak_pointer (G_OBJECT (client->priv->connection),
+ (gpointer *)
+ &client->priv->connection);
+ }
+
g_clear_object (&client->priv->manager);
g_clear_object (&client->priv->connection);