diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-09-06 10:38:27 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2018-09-06 10:43:12 +0200 |
commit | 38de53b19536e8878c294ace678f43b2f6366230 (patch) | |
tree | 995fae3d5e90ef659ec1d83522fb9e391335a611 | |
parent | 6e8aab2c4ed38d24c008ae4de36cb7c8bc8e3ca6 (diff) | |
download | ModemManager-38de53b19536e8878c294ace678f43b2f6366230.tar.gz |
broadband-modem-qmi: make sure result values are not in context when completing
In order to avoid having the result values in 2 places (context and
result) when the GTask is completed, we will steal the pointer from
the context before it's set as result of the GTask.
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index a7f9af0f3..f77dd5461 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -9961,11 +9961,15 @@ signal_load_values_context_step (GTask *task) case SIGNAL_LOAD_VALUES_STEP_SIGNAL_LAST: /* If any result is set, succeed */ if (VALUES_RESULT_LOADED (ctx)) { + SignalLoadValuesResult *values_result; + + /* Steal results from context in order to return them */ + values_result = ctx->values_result; + ctx->values_result = NULL; + g_task_return_pointer (task, - ctx->values_result, + values_result, (GDestroyNotify)signal_load_values_result_free); - /* Prevent values_result from being freed by signal_load_values_context_free */ - ctx->values_result = NULL; } else { g_task_return_new_error (task, MM_CORE_ERROR, |