Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
34319496
Commit
34319496
authored
Sep 25, 2023
by
Yuxuan Shui
Committed by
Alexandre Julliard
Sep 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtworkq: Fix leak of thread pool work items.
parent
20f88c83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
queue.c
dlls/rtworkq/queue.c
+26
-5
No files found.
dlls/rtworkq/queue.c
View file @
34319496
...
@@ -118,6 +118,13 @@ enum system_queue_index
...
@@ -118,6 +118,13 @@ enum system_queue_index
SYS_QUEUE_COUNT
,
SYS_QUEUE_COUNT
,
};
};
enum
work_item_type
{
WORK_ITEM_WORK
,
WORK_ITEM_TIMER
,
WORK_ITEM_WAIT
,
};
struct
work_item
struct
work_item
{
{
IUnknown
IUnknown_iface
;
IUnknown
IUnknown_iface
;
...
@@ -129,10 +136,11 @@ struct work_item
...
@@ -129,10 +136,11 @@ 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
;
enum
work_item_type
type
;
union
union
{
{
TP_WORK
*
work_object
;
TP_WAIT
*
wait_object
;
TP_WAIT
*
wait_object
;
TP_TIMER
*
timer_object
;
TP_TIMER
*
timer_object
;
}
u
;
}
u
;
...
@@ -387,8 +395,9 @@ static void pool_queue_submit(struct queue *queue, struct work_item *item)
...
@@ -387,8 +395,9 @@ 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
);
item
->
work_object
=
CreateThreadpoolWork
(
standard_queue_worker
,
item
,
(
TP_CALLBACK_ENVIRON
*
)
&
env
);
item
->
u
.
work_object
=
CreateThreadpoolWork
(
standard_queue_worker
,
item
,
(
TP_CALLBACK_ENVIRON
*
)
&
env
);
SubmitThreadpoolWork
(
item
->
work_object
);
item
->
type
=
WORK_ITEM_WORK
;
SubmitThreadpoolWork
(
item
->
u
.
work_object
);
TRACE
(
"dispatched %p.
\n
"
,
item
->
result
);
TRACE
(
"dispatched %p.
\n
"
,
item
->
result
);
}
}
...
@@ -549,8 +558,18 @@ static ULONG WINAPI work_item_Release(IUnknown *iface)
...
@@ -549,8 +558,18 @@ static ULONG WINAPI work_item_Release(IUnknown *iface)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
if
(
item
->
work_object
)
switch
(
item
->
type
)
CloseThreadpoolWork
(
item
->
work_object
);
{
case
WORK_ITEM_WORK
:
if
(
item
->
u
.
work_object
)
CloseThreadpoolWork
(
item
->
u
.
work_object
);
break
;
case
WORK_ITEM_WAIT
:
if
(
item
->
u
.
wait_object
)
CloseThreadpoolWait
(
item
->
u
.
wait_object
);
break
;
case
WORK_ITEM_TIMER
:
if
(
item
->
u
.
timer_object
)
CloseThreadpoolTimer
(
item
->
u
.
timer_object
);
break
;
}
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
);
...
@@ -814,6 +833,7 @@ static HRESULT queue_submit_wait(struct queue *queue, HANDLE event, LONG priorit
...
@@ -814,6 +833,7 @@ static HRESULT queue_submit_wait(struct queue *queue, HANDLE event, LONG priorit
item
->
u
.
wait_object
=
CreateThreadpoolWait
(
callback
,
item
,
item
->
u
.
wait_object
=
CreateThreadpoolWait
(
callback
,
item
,
(
TP_CALLBACK_ENVIRON
*
)
&
queue
->
envs
[
TP_CALLBACK_PRIORITY_NORMAL
]);
(
TP_CALLBACK_ENVIRON
*
)
&
queue
->
envs
[
TP_CALLBACK_PRIORITY_NORMAL
]);
item
->
type
=
WORK_ITEM_WAIT
;
SetThreadpoolWait
(
item
->
u
.
wait_object
,
event
,
NULL
);
SetThreadpoolWait
(
item
->
u
.
wait_object
,
event
,
NULL
);
TRACE
(
"dispatched %p.
\n
"
,
result
);
TRACE
(
"dispatched %p.
\n
"
,
result
);
...
@@ -848,6 +868,7 @@ static HRESULT queue_submit_timer(struct queue *queue, IRtwqAsyncResult *result,
...
@@ -848,6 +868,7 @@ static HRESULT queue_submit_timer(struct queue *queue, IRtwqAsyncResult *result,
item
->
u
.
timer_object
=
CreateThreadpoolTimer
(
callback
,
item
,
item
->
u
.
timer_object
=
CreateThreadpoolTimer
(
callback
,
item
,
(
TP_CALLBACK_ENVIRON
*
)
&
queue
->
envs
[
TP_CALLBACK_PRIORITY_NORMAL
]);
(
TP_CALLBACK_ENVIRON
*
)
&
queue
->
envs
[
TP_CALLBACK_PRIORITY_NORMAL
]);
item
->
type
=
WORK_ITEM_TIMER
;
SetThreadpoolTimer
(
item
->
u
.
timer_object
,
&
filetime
,
period
,
0
);
SetThreadpoolTimer
(
item
->
u
.
timer_object
,
&
filetime
,
period
,
0
);
TRACE
(
"dispatched %p.
\n
"
,
result
);
TRACE
(
"dispatched %p.
\n
"
,
result
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment