clients/secret-agent: use nm-utils error reason for callback while disposing NMSecretAgentSimple

No caller cared about the NM_SECRET_AGENT_ERROR_AGENT_CANCELED reason.
In particular, because previously the requests would keep the secret-agent
instance alive, and this never happend.

Also, NM_SECRET_AGENT_ERROR_AGENT_CANCELED precicley exists for
NMSecretAgentOld:cancel_get_secrets() (as documented). During finalize
we are not cancelled -- at least not the same way as
cancel_get_secrets(). Setting NM_SECRET_AGENT_ERROR_AGENT_CANCELED
is wrong.

Anyway, we have a default error for such cases already.
This commit is contained in:
Thomas Haller 2019-01-22 12:15:03 +01:00
parent d68bdce206
commit 82472c557c

View file

@ -1135,15 +1135,12 @@ dispose (GObject *object)
g_hash_table_iter_init (&iter, priv->requests);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &request)) {
if (!error) {
g_set_error (&error,
NM_SECRET_AGENT_ERROR,
NM_SECRET_AGENT_ERROR_AGENT_CANCELED,
"The secret agent is going away");
}
if (!error)
nm_utils_error_set_cancelled (&error, TRUE, "NMSecretAgentSimple");
request->callback (NM_SECRET_AGENT_OLD (object),
request->connection,
NULL, error,
NULL,
error,
request->callback_data);
g_hash_table_iter_remove (&iter);
}