Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8098edb6
Commit
8098edb6
authored
Mar 11, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Close event handle on async result release.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
68f576f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
0 deletions
+69
-0
queue.c
dlls/mfplat/queue.c
+2
-0
mfplat.c
dlls/mfplat/tests/mfplat.c
+67
-0
No files found.
dlls/mfplat/queue.c
View file @
8098edb6
...
...
@@ -649,6 +649,8 @@ static ULONG WINAPI async_result_Release(IMFAsyncResult *iface)
IUnknown_Release
(
result
->
object
);
if
(
result
->
state
)
IUnknown_Release
(
result
->
state
);
if
(
result
->
result
.
hEvent
)
CloseHandle
(
result
->
result
.
hEvent
);
heap_free
(
result
);
MFUnlockPlatform
();
...
...
dlls/mfplat/tests/mfplat.c
View file @
8098edb6
...
...
@@ -904,7 +904,10 @@ static void test_MFCreateAsyncResult(void)
IUnknown
*
state
,
*
object
;
MFASYNCRESULT
*
data
;
ULONG
refcount
;
HANDLE
event
;
DWORD
flags
;
HRESULT
hr
;
BOOL
ret
;
init_test_callback
(
&
callback
);
...
...
@@ -991,6 +994,35 @@ static void test_MFCreateAsyncResult(void)
ok
(
!
refcount
,
"Unexpected refcount %u
\n
."
,
refcount
);
refcount
=
IMFAsyncResult_Release
(
result
);
ok
(
!
refcount
,
"Unexpected refcount %u
\n
."
,
refcount
);
/* Event handle is closed on release. */
hr
=
MFCreateAsyncResult
(
NULL
,
NULL
,
NULL
,
&
result
);
ok
(
hr
==
S_OK
,
"Failed to create object, hr %#x.
\n
"
,
hr
);
data
=
(
MFASYNCRESULT
*
)
result
;
data
->
hEvent
=
event
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
data
->
hEvent
!=
NULL
,
"Failed to create event.
\n
"
);
ret
=
GetHandleInformation
(
event
,
&
flags
);
ok
(
ret
,
"Failed to get handle info.
\n
"
);
refcount
=
IMFAsyncResult_Release
(
result
);
ok
(
!
refcount
,
"Unexpected refcount %u
\n
."
,
refcount
);
ret
=
GetHandleInformation
(
event
,
&
flags
);
ok
(
!
ret
,
"Expected handle to be closed.
\n
"
);
hr
=
MFCreateAsyncResult
(
NULL
,
&
callback
.
IMFAsyncCallback_iface
,
NULL
,
&
result
);
ok
(
hr
==
S_OK
,
"Failed to create object, hr %#x.
\n
"
,
hr
);
data
=
(
MFASYNCRESULT
*
)
result
;
data
->
hEvent
=
event
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
data
->
hEvent
!=
NULL
,
"Failed to create event.
\n
"
);
ret
=
GetHandleInformation
(
event
,
&
flags
);
ok
(
ret
,
"Failed to get handle info.
\n
"
);
refcount
=
IMFAsyncResult_Release
(
result
);
ok
(
!
refcount
,
"Unexpected refcount %u
\n
."
,
refcount
);
ret
=
GetHandleInformation
(
event
,
&
flags
);
ok
(
!
ret
,
"Expected handle to be closed.
\n
"
);
}
static
void
test_startup
(
void
)
...
...
@@ -1693,6 +1725,40 @@ static void test_system_time_source(void)
IMFPresentationTimeSource_Release
(
time_source
);
}
static
void
test_MFInvokeCallback
(
void
)
{
struct
test_callback
callback
;
IMFAsyncResult
*
result
;
MFASYNCRESULT
*
data
;
ULONG
refcount
;
HRESULT
hr
;
DWORD
ret
;
hr
=
MFStartup
(
MF_VERSION
,
MFSTARTUP_FULL
);
ok
(
hr
==
S_OK
,
"Failed to start up, hr %#x.
\n
"
,
hr
);
init_test_callback
(
&
callback
);
hr
=
MFCreateAsyncResult
(
NULL
,
&
callback
.
IMFAsyncCallback_iface
,
NULL
,
&
result
);
ok
(
hr
==
S_OK
,
"Failed to create object, hr %#x.
\n
"
,
hr
);
data
=
(
MFASYNCRESULT
*
)
result
;
data
->
hEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
data
->
hEvent
!=
NULL
,
"Failed to create event.
\n
"
);
hr
=
MFInvokeCallback
(
result
);
ok
(
hr
==
S_OK
,
"Failed to invoke, hr %#x.
\n
"
,
hr
);
ret
=
WaitForSingleObject
(
data
->
hEvent
,
100
);
ok
(
ret
==
WAIT_TIMEOUT
,
"Expected timeout, ret %#x.
\n
"
,
ret
);
refcount
=
IMFAsyncResult_Release
(
result
);
ok
(
!
refcount
,
"Unexpected refcount %u
\n
."
,
refcount
);
hr
=
MFShutdown
();
ok
(
hr
==
S_OK
,
"Failed to shut down, hr %#x.
\n
"
,
hr
);
}
START_TEST
(
mfplat
)
{
CoInitialize
(
NULL
);
...
...
@@ -1720,6 +1786,7 @@ START_TEST(mfplat)
test_event_queue
();
test_presentation_descriptor
();
test_system_time_source
();
test_MFInvokeCallback
();
CoUninitialize
();
}
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