Commit 7ff2bbc0 authored by George Kiagiadakis's avatar George Kiagiadakis Committed by Julian Bouzas
Browse files

pw-object-mixin: watch for proxy errors during enum_params

parent 0b558eca
......@@ -116,13 +116,13 @@ enum_params_done (WpCore * core, GAsyncResult * res, gpointer data)
/* finish the sync task */
wp_core_sync_finish (core, res, &error);
/* return if the task was cancelled */
if (g_task_get_completed (task))
return;
/* remove the task from the stored list; ref is held by the g_autoptr */
d->enum_params_tasks = g_list_remove (d->enum_params_tasks, task);
/* return if the task was cancelled or received an error */
if (g_task_get_completed (task))
return;
wp_debug_object (instance, "got %u params, %s, task " WP_OBJECT_FORMAT,
params->len, error ? "with error" : "ok", WP_OBJECT_ARGS (task));
......@@ -134,6 +134,19 @@ enum_params_done (WpCore * core, GAsyncResult * res, gpointer data)
}
}
static void
enum_params_error (WpProxy * proxy, int seq, int res, const gchar *msg,
GTask * task)
{
gint t_seq = GPOINTER_TO_INT (g_task_get_source_tag (G_TASK (task)));
if (SPA_RESULT_ASYNC_SEQ (t_seq) == SPA_RESULT_ASYNC_SEQ (seq) &&
!g_task_get_completed (task)) {
g_task_return_new_error (task, WP_DOMAIN_LIBRARY,
WP_LIBRARY_ERROR_OPERATION_FAILED, "%s", msg);
}
}
static void
wp_pw_object_mixin_enum_params_unchecked (gpointer obj,
guint32 id, WpSpaPod *filter, GCancellable * cancellable,
......@@ -183,6 +196,10 @@ wp_pw_object_mixin_enum_params_unchecked (gpointer obj,
} else {
g_autoptr (WpCore) core = wp_object_get_core (WP_OBJECT (obj));
/* watch for errors */
g_signal_connect_object (obj, "error", G_CALLBACK (enum_params_error),
task, 0);
/* store */
g_task_set_task_data (task, params, (GDestroyNotify) g_ptr_array_unref);
g_task_set_source_tag (task, GINT_TO_POINTER (seq));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment