Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions libdleyna/core/task-processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,8 @@ static gboolean prv_cancel_only(const dleyna_task_queue_key_t *queue_id,
if (task_queue->current_task)
task_queue->task_cancel_cb(task_queue->current_task,
task_queue->user_data);
else
remove_queue = task_queue->flags &
DLEYNA_TASK_QUEUE_FLAG_AUTO_REMOVE;

remove_queue = task_queue->flags & DLEYNA_TASK_QUEUE_FLAG_AUTO_REMOVE;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually preventing the g_hash_table_remove, right? Because the callback can still return TRUE.

I think the original code here was OK, because if we remove the queue for the running task then ...


out:

Expand Down Expand Up @@ -446,19 +445,24 @@ void dleyna_task_queue_task_completed(const dleyna_task_queue_key_t *queue_id)
{
dleyna_task_queue_t *queue;
dleyna_task_processor_t *processor = queue_id->processor;
gboolean current_task_was_cancelled = FALSE;

DLEYNA_LOG_DEBUG("Enter - Task completed for queue <%s,%s>",
queue_id->source, queue_id->sink);

queue = g_hash_table_lookup(processor->task_queues, queue_id);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... queue would be NULL here.


if (queue->current_task) {
current_task_was_cancelled = queue->cancelled;
queue->task_delete_cb(queue->current_task, queue->user_data);
queue->current_task = NULL;
}

processor->running_tasks--;

if (current_task_was_cancelled)
goto out;

if (processor->quitting && !processor->running_tasks) {
g_idle_add(processor->on_quit_cb, NULL);
g_hash_table_remove_all(processor->task_queues);
Expand All @@ -475,6 +479,7 @@ void dleyna_task_queue_task_completed(const dleyna_task_queue_key_t *queue_id)
g_hash_table_remove(processor->task_queues, queue_id);
}

out:
DLEYNA_LOG_DEBUG("Exit");
}

Expand Down