Module: wine Branch: master Commit: 48b713efab642c36467a96122edf0c4d7422f64a URL: https://source.winehq.org/git/wine.git/?a=commit;h=48b713efab642c36467a96122...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Mar 1 11:03:14 2019 +0300
mfplat: Cleanup user queues.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mfplat/queue.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index c793caa..23e54a5 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -254,6 +254,28 @@ static HRESULT lock_user_queue(DWORD queue) return hr; }
+static void shutdown_queue(struct queue *queue) +{ + struct work_item *item, *item2; + + if (!queue->pool) + return; + + CloseThreadpoolCleanupGroupMembers(queue->env.CleanupGroup, TRUE, NULL); + CloseThreadpool(queue->pool); + queue->pool = NULL; + + EnterCriticalSection(&queue->cs); + LIST_FOR_EACH_ENTRY_SAFE(item, item2, &queue->pending_items, struct work_item, entry) + { + list_remove(&item->entry); + release_work_item(item); + } + LeaveCriticalSection(&queue->cs); + + DeleteCriticalSection(&queue->cs); +} + static HRESULT unlock_user_queue(DWORD queue) { HRESULT hr = MF_E_INVALID_WORKQUEUE; @@ -268,6 +290,8 @@ static HRESULT unlock_user_queue(DWORD queue) { if (--entry->refcount == 0) { + shutdown_queue((struct queue *)entry->obj); + heap_free(entry->obj); entry->obj = next_free_user_queue; next_free_user_queue = entry; } @@ -277,28 +301,6 @@ static HRESULT unlock_user_queue(DWORD queue) return hr; }
-static void shutdown_queue(struct queue *queue) -{ - struct work_item *item, *item2; - - if (!queue->pool) - return; - - CloseThreadpoolCleanupGroupMembers(queue->env.CleanupGroup, TRUE, NULL); - CloseThreadpool(queue->pool); - queue->pool = NULL; - - EnterCriticalSection(&queue->cs); - LIST_FOR_EACH_ENTRY_SAFE(item, item2, &queue->pending_items, struct work_item, entry) - { - list_remove(&item->entry); - release_work_item(item); - } - LeaveCriticalSection(&queue->cs); - - DeleteCriticalSection(&queue->cs); -} - void shutdown_system_queues(void) { unsigned int i;