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.
This commit is contained in:
@@ -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)) {
|
||||
g_task_return_pointer (task,
|
||||
ctx->values_result,
|
||||
(GDestroyNotify)signal_load_values_result_free);
|
||||
/* Prevent values_result from being freed by signal_load_values_context_free */
|
||||
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,
|
||||
values_result,
|
||||
(GDestroyNotify)signal_load_values_result_free);
|
||||
} else {
|
||||
g_task_return_new_error (task,
|
||||
MM_CORE_ERROR,
|
||||
|
||||
Reference in New Issue
Block a user