From 841e06be5e99e12334209ad876fd5df92338b6d2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 27 Feb 2023 15:45:56 +0100 Subject: [PATCH] cloud-setup: don't pass separate user-data when polling in nm_http_client_poll_req() nmcs_utils_poll() accepts two different user-data. One is passed to the probe callbacks (and returned by nmcs_utils_poll_finish()). The other one is passed to the callback. Having separate user data might be useful. It's not useful for nm_http_client_poll_req(), which both passes the same. It's confusing to pass the same data as different user-data. Don't do that. Use only one way. --- src/nm-cloud-setup/nm-http-client.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nm-cloud-setup/nm-http-client.c b/src/nm-cloud-setup/nm-http-client.c index b3db93e058..c78e31a1f8 100644 --- a/src/nm-cloud-setup/nm-http-client.c +++ b/src/nm-cloud-setup/nm-http-client.c @@ -508,13 +508,14 @@ _poll_req_probe_finish_fcn(GObject *source, static void _poll_req_done_cb(GObject *source, GAsyncResult *result, gpointer user_data) { - PollReqData *poll_req_data = user_data; + PollReqData *poll_req_data = NULL; gs_free_error GError *error = NULL; gboolean success; - success = nmcs_utils_poll_finish(result, NULL, &error); + success = nmcs_utils_poll_finish(result, (gpointer *) &poll_req_data, &error); nm_assert((!!success) == (!error)); + nm_assert(poll_req_data); if (error) g_task_return_error(poll_req_data->task, g_steal_pointer(&error)); @@ -582,7 +583,7 @@ nm_http_client_poll_req(NMHttpClient *self, poll_req_data, cancellable, _poll_req_done_cb, - poll_req_data); + NULL); } gboolean