fix: glib assertion in nm-agent-manager, cancelling completed dbus call

This fixes a glib assertion:
"dbus_g_proxy_cancel_call: assertion `pending != NULL' failed"

Backtrace:
 #0  0x00007f962dad9e0d in g_logv () from /lib64/libglib-2.0.so.0
 #1  0x00007f962dad9ff2 in g_log () from /lib64/libglib-2.0.so.0
 #2  0x00000000004a84bd in nm_secret_agent_cancel_secrets (self=0x213b300, call=0x1) at settings/nm-secret-agent.c:331
 #3  0x00000000004a4068 in request_free (req=0x216a490) at settings/nm-agent-manager.c:479
 #4  0x00007f962dac25fa in g_hash_table_remove_internal () from /lib64/libglib-2.0.so.0

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Dan Williams 2013-08-30 18:21:44 +02:00 committed by Thomas Haller
parent 8c167c1f8f
commit 0c15e1c2ce

View file

@ -430,6 +430,7 @@ struct _Request {
RequestNextFunc next_callback;
RequestCompleteFunc complete_callback;
gpointer complete_callback_data;
gboolean completed;
GDestroyNotify free_func;
};
@ -475,7 +476,7 @@ request_free (Request *req)
if (req->idle_id)
g_source_remove (req->idle_id);
if (req->cancel_callback)
if (!req->completed && req->cancel_callback)
req->cancel_callback (req);
g_free (req->detail);
@ -492,6 +493,7 @@ req_complete_success (Request *req,
const char *agent_dbus_owner,
const char *agent_uname)
{
req->completed = TRUE;
req->complete_callback (req,
secrets,
agent_dbus_owner,
@ -503,6 +505,7 @@ req_complete_success (Request *req,
static void
req_complete_error (Request *req, GError *error)
{
req->completed = TRUE;
req->complete_callback (req, NULL, NULL, NULL, error, req->complete_callback_data);
}