Skip to content
Snippets Groups Projects
Commit 7d74dd91 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard
Browse files

evr/sample: Avoid a race condition when releasing a tracked sample.


Same as b1807751.

Signed-off-by: default avatarNikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard's avatarAlexandre Julliard <julliard@winehq.org>
(cherry picked from commit ce71f5a0)
Signed-off-by: default avatarMichael Stefaniuc <mstefani@winehq.org>
parent 967b3294
No related branches found
No related tags found
No related merge requests found
......@@ -920,19 +920,21 @@ static ULONG WINAPI video_sample_AddRef(IMFSample *iface)
static ULONG WINAPI video_sample_Release(IMFSample *iface)
{
struct video_sample *sample = impl_from_IMFSample(iface);
ULONG refcount;
ULONG refcount = InterlockedDecrement(&sample->refcount);
IMFAsyncResult *tracked_result = NULL;
IMFSample_LockStore(sample->sample);
if (sample->tracked_result && sample->tracked_refcount == (sample->refcount - 1))
if (sample->tracked_result && sample->tracked_refcount == refcount)
{
video_sample_tracking_thread_invoke(sample->tracked_result);
IMFAsyncResult_Release(sample->tracked_result);
tracked_result = sample->tracked_result;
video_sample_tracking_thread_invoke(tracked_result);
sample->tracked_result = NULL;
sample->tracked_refcount = 0;
}
IMFSample_UnlockStore(sample->sample);
refcount = InterlockedDecrement(&sample->refcount);
if (tracked_result)
IMFAsyncResult_Release(tracked_result);
TRACE("%p, refcount %u.\n", iface, refcount);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment