[PATCH 2/2] mfreadwrite/reader: Unset sample allocator callbacks while destroying the source reader.
Giovanni Mascellani
gmascellani at codeweavers.com
Fri Apr 8 08:20:42 CDT 2022
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: Giovanni Mascellani <gmascellani at codeweavers.com>
---
dlls/mfreadwrite/reader.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c
index 2d3da19db10..1c86a10a824 100644
--- a/dlls/mfreadwrite/reader.c
+++ b/dlls/mfreadwrite/reader.c
@@ -1430,6 +1430,25 @@ 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)))
+ {
+ HRESULT hr;
+
+ if (FAILED(hr = IMFVideoSampleAllocatorCallback_SetCallback(callback, NULL)))
+ WARN("Cannot unset allocator callback, hr %#x.\n", hr);
+ IMFVideoSampleAllocatorCallback_Release(callback);
+ }
+ }
+
source_reader_release(reader);
}
--
2.35.1
More information about the wine-devel
mailing list