Commit a233c495 authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

mfreadwrite/reader: Unset sample allocator callbacks while destroying the source reader.

The sample allocator callbacks own a reference to the source reader, which creates a reference loop and prevents the source reader from being properly destroyed. Signed-off-by: 's avatarGiovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent cdb0471e
......@@ -1412,6 +1412,7 @@ static ULONG WINAPI src_reader_Release(IMFSourceReader *iface)
{
struct source_reader *reader = impl_from_IMFSourceReader(iface);
ULONG refcount = InterlockedDecrement(&reader->public_refcount);
unsigned int i;
TRACE("%p, refcount %lu.\n", iface, refcount);
......@@ -1430,6 +1431,23 @@ static ULONG WINAPI src_reader_Release(IMFSourceReader *iface)
LeaveCriticalSection(&reader->cs);
}
for (i = 0; i < reader->stream_count; ++i)
{
struct media_stream *stream = &reader->streams[i];
IMFVideoSampleAllocatorCallback *callback;
if (!stream->allocator)
continue;
if (SUCCEEDED(IMFVideoSampleAllocatorEx_QueryInterface(stream->allocator, &IID_IMFVideoSampleAllocatorCallback,
(void **)&callback)))
{
IMFVideoSampleAllocatorCallback_SetCallback(callback, NULL);
IMFVideoSampleAllocatorCallback_Release(callback);
}
}
source_reader_release(reader);
}
......
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