Zebediah Figura : quartz/memallocator: Clear some sample properties when freeing the sample.

Alexandre Julliard julliard at winehq.org
Mon Nov 25 09:12:25 CST 2019


Module: wine
Branch: stable
Commit: 03aca2e96bd9857e1ad8ebd48483897d9330f23e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=03aca2e96bd9857e1ad8ebd48483897d9330f23e

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Jun 21 22:35:41 2019 -0500

quartz/memallocator: Clear some sample properties when freeing the sample.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38421
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit b9073b1e94d7be21cc2ee2ada888eb1f0a019c52)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/quartz/memallocator.c       |  7 +++++++
 dlls/quartz/tests/memallocator.c | 24 ++++++++++++------------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index 477c63ae05..073441cac8 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -493,6 +493,13 @@ static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
 
     if (!ref)
     {
+        if (This->props.pMediaType)
+            DeleteMediaType(This->props.pMediaType);
+        This->props.pMediaType = NULL;
+        This->props.dwSampleFlags = 0;
+        This->tMediaStart = INVALID_MEDIA_TIME;
+        This->tMediaEnd = 0;
+
         if (This->pParent)
             IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
         else
diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c
index eed6d7463e..e905aeb427 100644
--- a/dlls/quartz/tests/memallocator.c
+++ b/dlls/quartz/tests/memallocator.c
@@ -234,13 +234,13 @@ static void test_sample_time(void)
     start = 0xdeadbeef;
     end = 0xdeadf00d;
     hr = IMediaSample_GetTime(sample, &start, &end);
-    todo_wine ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
-    todo_wine ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
-    todo_wine ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
+    ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
 
     start = 0x123;
     end = 0x321;
@@ -248,7 +248,7 @@ static void test_sample_time(void)
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    todo_wine ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
 
     IMediaSample2_Release(sample2);
     IMediaSample_Release(sample);
@@ -320,9 +320,9 @@ static void test_media_time(void)
     start = 0xdeadbeef;
     end = 0xdeadf00d;
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
-    todo_wine ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
-    todo_wine ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
+    ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     start = 0x123;
     end = 0x321;
@@ -330,7 +330,7 @@ static void test_media_time(void)
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
 
     start = 0x123;
     end = 0x321;
@@ -343,7 +343,7 @@ static void test_media_time(void)
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    todo_wine ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
 
     IMediaSample_Release(sample);
     IMemAllocator_Release(allocator);
@@ -548,11 +548,11 @@ static void test_sample_properties(void)
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#x.\n", props.dwTypeSpecificFlags);
-    todo_wine ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
     ok(props.lActual == 123, "Got actual length %d.\n", props.lActual);
     ok(!props.tStart, "Got sample start %s.\n", wine_dbgstr_longlong(props.tStart));
     ok(!props.dwStreamId, "Got stream ID %#x.\n", props.dwStreamId);
-    todo_wine ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType);
+    ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType);
     ok(props.cbBuffer == 65536, "Got buffer length %d.\n", props.cbBuffer);
 
     IMediaSample2_Release(sample2);




More information about the wine-cvs mailing list