port-qmi: fix QMI client allocation procedure

Commit 26ee94ec28 introduced a bug, where we would be completing
the client allocation task *before* tracking the new client allocation
info in the private tracking list.

This meant that if mm_port_qmi_peek_client() was called in the task
completion handler, the client object wouldn't be returned, as it
wasn't found in the private tracking list.

The fix is just to defer the task completion until after the private
tracking list is updated.

Reported-by: Salvador Penalva <salvador.penalva@digi.com>
This commit is contained in:
Aleksander Morgado
2017-05-05 11:33:11 +02:00
parent f3cc78ef02
commit 2373a4b658
+1 -1
View File
@@ -112,10 +112,10 @@ allocate_client_ready (QmiDevice *qmi_device,
qmi_service_get_string (ctx->info->service));
g_task_return_error (task, error);
} else {
g_task_return_boolean (task, TRUE);
/* Move the service info to our internal list */
self->priv->services = g_list_prepend (self->priv->services, ctx->info);
ctx->info = NULL;
g_task_return_boolean (task, TRUE);
}
g_object_unref (task);