Commit cfff3306 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

rtworkq: Release thread pool work object when work_item is destroyed (Valgrind).

parent f85c5f1c
...@@ -131,6 +131,7 @@ struct work_item ...@@ -131,6 +131,7 @@ struct work_item
RTWQWORKITEM_KEY key; RTWQWORKITEM_KEY key;
LONG priority; LONG priority;
DWORD flags; DWORD flags;
TP_WORK *work_object;
PTP_SIMPLE_CALLBACK finalization_callback; PTP_SIMPLE_CALLBACK finalization_callback;
union union
{ {
...@@ -374,7 +375,6 @@ static void pool_queue_submit(struct queue *queue, struct work_item *item) ...@@ -374,7 +375,6 @@ static void pool_queue_submit(struct queue *queue, struct work_item *item)
{ {
TP_CALLBACK_PRIORITY callback_priority; TP_CALLBACK_PRIORITY callback_priority;
TP_CALLBACK_ENVIRON_V3 env; TP_CALLBACK_ENVIRON_V3 env;
TP_WORK *work_object;
if (item->priority == 0) if (item->priority == 0)
callback_priority = TP_CALLBACK_PRIORITY_NORMAL; callback_priority = TP_CALLBACK_PRIORITY_NORMAL;
...@@ -389,8 +389,8 @@ static void pool_queue_submit(struct queue *queue, struct work_item *item) ...@@ -389,8 +389,8 @@ static void pool_queue_submit(struct queue *queue, struct work_item *item)
we need finalization callback. */ we need finalization callback. */
if (item->finalization_callback) if (item->finalization_callback)
IUnknown_AddRef(&item->IUnknown_iface); IUnknown_AddRef(&item->IUnknown_iface);
work_object = CreateThreadpoolWork(standard_queue_worker, item, (TP_CALLBACK_ENVIRON *)&env); item->work_object = CreateThreadpoolWork(standard_queue_worker, item, (TP_CALLBACK_ENVIRON *)&env);
SubmitThreadpoolWork(work_object); SubmitThreadpoolWork(item->work_object);
TRACE("dispatched %p.\n", item->result); TRACE("dispatched %p.\n", item->result);
} }
...@@ -551,6 +551,8 @@ static ULONG WINAPI work_item_Release(IUnknown *iface) ...@@ -551,6 +551,8 @@ static ULONG WINAPI work_item_Release(IUnknown *iface)
if (!refcount) if (!refcount)
{ {
if (item->work_object)
CloseThreadpoolWork(item->work_object);
if (item->reply_result) if (item->reply_result)
IRtwqAsyncResult_Release(item->reply_result); IRtwqAsyncResult_Release(item->reply_result);
IRtwqAsyncResult_Release(item->result); IRtwqAsyncResult_Release(item->result);
......
Markdown is supported
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