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

mfreadwrite/reader: Make the stream sample allocator callback own a reference to the source reader.

The stream sample allocator callback NotifyRelease() method assumes that the source reader is valid. Therefore it must own a reference to it, otherwise it might get called while the source reader is being destroyed, causing a crash. 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 a4e4e19f
......@@ -2282,12 +2282,14 @@ static HRESULT WINAPI stream_sample_allocator_cb_QueryInterface(IMFVideoSampleAl
static ULONG WINAPI stream_sample_allocator_cb_AddRef(IMFVideoSampleAllocatorNotify *iface)
{
return 2;
struct media_stream *stream = impl_stream_from_IMFVideoSampleAllocatorNotify(iface);
return source_reader_addref(stream->reader);
}
static ULONG WINAPI stream_sample_allocator_cb_Release(IMFVideoSampleAllocatorNotify *iface)
{
return 1;
struct media_stream *stream = impl_stream_from_IMFVideoSampleAllocatorNotify(iface);
return source_reader_release(stream->reader);
}
static HRESULT WINAPI stream_sample_allocator_cb_NotifyRelease(IMFVideoSampleAllocatorNotify *iface)
......
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