Commit 10b7be42 authored by Marco Trevisan's avatar Marco Trevisan 🎺

libgdm: Use Manager as unowned instance

In this way we can use the weak ref to reset the reference of the client
parent c67fe0fd
......@@ -90,13 +90,7 @@ on_got_manager (GdmManager *manager,
if (client->priv->manager == NULL) {
client->priv->manager = new_manager;
if (client->priv->connection != NULL) {
g_object_remove_weak_pointer (G_OBJECT (client->priv->connection),
(gpointer *)
&client->priv->connection);
client->priv->connection = NULL;
}
g_object_force_floating (G_OBJECT (client->priv->manager));
} else {
g_object_ref (client->priv->manager);
g_object_unref (new_manager);
......@@ -452,14 +446,6 @@ gdm_client_open_connection_sync (GdmClient *client,
"/org/gnome/DisplayManager/Manager",
cancellable,
error);
if (client->priv->connection != NULL) {
g_object_remove_weak_pointer (G_OBJECT (client->priv->connection),
(gpointer *)
&client->priv->connection);
client->priv->connection = NULL;
}
if (client->priv->manager == NULL) {
goto out;
}
......@@ -492,6 +478,7 @@ gdm_client_open_connection_sync (GdmClient *client,
goto out;
}
g_object_force_floating (G_OBJECT (client->priv->manager));
g_object_weak_ref (G_OBJECT (client->priv->manager),
on_manager_destroyed, client);
g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
......@@ -747,8 +734,8 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
g_object_weak_ref (G_OBJECT (user_verifier),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
}
out:
......@@ -853,8 +840,8 @@ gdm_client_get_user_verifier_sync (GdmClient *client,
&client->priv->user_verifier);
g_object_weak_ref (G_OBJECT (client->priv->user_verifier),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
g_object_weak_ref (G_OBJECT (client->priv->user_verifier),
(GWeakNotify)
g_object_unref,
......@@ -1003,8 +990,8 @@ gdm_client_get_user_verifier_finish (GdmClient *client,
g_object_weak_ref (G_OBJECT (client->priv->user_verifier),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
return user_verifier;
}
......@@ -1178,8 +1165,8 @@ gdm_client_get_greeter_finish (GdmClient *client,
g_object_weak_ref (G_OBJECT (client->priv->greeter),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
return greeter;
}
......@@ -1223,8 +1210,8 @@ gdm_client_get_greeter_sync (GdmClient *client,
&client->priv->greeter);
g_object_weak_ref (G_OBJECT (client->priv->greeter),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
g_object_weak_ref (G_OBJECT (client->priv->greeter),
(GWeakNotify)
g_object_unref,
......@@ -1363,8 +1350,8 @@ gdm_client_get_remote_greeter_finish (GdmClient *client,
g_object_weak_ref (G_OBJECT (client->priv->remote_greeter),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
client->priv->manager);
return remote_greeter;
}
......@@ -1407,8 +1394,8 @@ gdm_client_get_remote_greeter_sync (GdmClient *client,
&client->priv->remote_greeter);
g_object_weak_ref (G_OBJECT (client->priv->remote_greeter),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
g_object_weak_ref (G_OBJECT (client->priv->remote_greeter),
(GWeakNotify)
g_object_unref,
......@@ -1545,8 +1532,8 @@ gdm_client_get_chooser_finish (GdmClient *client,
g_object_weak_ref (G_OBJECT (client->priv->chooser),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
return chooser;
}
......@@ -1590,8 +1577,8 @@ gdm_client_get_chooser_sync (GdmClient *client,
&client->priv->chooser);
g_object_weak_ref (G_OBJECT (client->priv->chooser),
(GWeakNotify)
g_clear_object,
&client->priv->manager);
g_object_unref,
g_object_ref_sink (client->priv->manager));
g_object_weak_ref (G_OBJECT (client->priv->chooser),
(GWeakNotify)
g_object_unref,
......
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