Commit b3cfe302 authored by Marco Trevisan's avatar Marco Trevisan 🎺 Committed by Iain Lane

libgdm: 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
(cherry picked from commit ccba35d5)
parent 68910f30
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment