You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dleyna-core/SOURCES/dleyna-core-Make-the-task-p...

73 lines
2.2 KiB

From 48d5213ad10278a3e419b66e4bc3c678254a3c34 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@freedesktop.org>
Date: Fri, 4 Dec 2020 14:47:13 +0100
Subject: [PATCH 1/2] Remove any pending task processing handlers when
destroying a queue
https://github.com/phako/dleyna-core/pull/2
---
libdleyna/core/task-processor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libdleyna/core/task-processor.c b/libdleyna/core/task-processor.c
index f50dd569ed61..8065a205c061 100644
--- a/libdleyna/core/task-processor.c
+++ b/libdleyna/core/task-processor.c
@@ -96,6 +96,11 @@ static void prv_free_cb(gpointer data)
DLEYNA_LOG_DEBUG("Enter");
+ if (task_queue->idle_id) {
+ g_source_remove(task_queue->idle_id);
+ task_queue->idle_id = 0;
+ }
+
g_ptr_array_foreach(task_queue->tasks, prv_task_free_cb, task_queue);
g_ptr_array_unref(task_queue->tasks);
--
2.28.0
From 00c959020de6bfdccace493703dfcdd45d74d479 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@freedesktop.org>
Date: Fri, 4 Dec 2020 20:24:20 +0100
Subject: [PATCH 2/2] Remove queues only if dleyna_task_processor_t->on_quit_cb
is scheduled
See commit 1de3325c201dc0e1 for the original reason why all the queues
need to be removed before dleyna_task_processor_t->on_quit_cb is run.
However, if we remove them too early then there might still be tasks
in flight that need to use them.
https://bugzilla.redhat.com/show_bug.cgi?id=1890618
https://github.com/phako/dleyna-core/pull/2
---
libdleyna/core/task-processor.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libdleyna/core/task-processor.c b/libdleyna/core/task-processor.c
index 8065a205c061..14972303c307 100644
--- a/libdleyna/core/task-processor.c
+++ b/libdleyna/core/task-processor.c
@@ -257,12 +257,12 @@ void dleyna_task_processor_set_quitting(dleyna_task_processor_t *processor)
DLEYNA_LOG_DEBUG("Enter");
processor->quitting = TRUE;
+ prv_cancel_all_queues(processor);
- if (processor->running_tasks == 0)
+ if (processor->running_tasks == 0) {
g_idle_add(processor->on_quit_cb, NULL);
-
- prv_cancel_all_queues(processor);
- g_hash_table_remove_all(processor->task_queues);
+ g_hash_table_remove_all(processor->task_queues);
+ }
DLEYNA_LOG_DEBUG("Exit");
}
--
2.28.0