From 82472c557cc966b14d3e1186605a7fc3e37dc17d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 22 Jan 2019 12:15:03 +0100 Subject: [PATCH] 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. --- clients/common/nm-secret-agent-simple.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index 2c83de44b3..b4530af61d 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -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); }