Zebediah Figura : quartz/tests: Fix a crash in test_renderless_formats().

Alexandre Julliard julliard at winehq.org
Mon May 18 15:00:13 CDT 2020


Module: wine
Branch: master
Commit: 6b9bc1bff5f0488af8816e7669d1f2415c31e6ca
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6b9bc1bff5f0488af8816e7669d1f2415c31e6ca

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun May 17 14:38:13 2020 -0500

quartz/tests: Fix a crash in test_renderless_formats().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/vmr9.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 57e92ad714..dfa9dae73e 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -2979,14 +2979,14 @@ static void test_renderless_formats(void)
         .pbFormat = (BYTE *)&vih,
     };
     ALLOCATOR_PROPERTIES req_props = {5, 32 * 16 * 4, 1, 0}, ret_props;
-    IBaseFilter *filter = create_vmr9(VMR9Mode_Renderless);
-    IFilterGraph2 *graph = create_graph();
     IVMRSurfaceAllocatorNotify9 *notify;
     RECT rect = {0, 0, 640, 480};
     struct testfilter source;
     IDirect3DDevice9 *device;
     IMemAllocator *allocator;
+    IFilterGraph2 *graph;
     IMemInputPin *input;
+    IBaseFilter *filter;
     unsigned int i;
     HWND window;
     HRESULT hr;
@@ -3020,13 +3020,17 @@ static void test_renderless_formats(void)
         {&MEDIASUBTYPE_YV12, MAKEFOURCC('Y','V','1','2'), VMR9AllocFlag_OffscreenSurface},
     };
 
-    IBaseFilter_QueryInterface(filter, &IID_IVMRSurfaceAllocatorNotify9, (void **)&notify);
-
     AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
     window = CreateWindowA("static", "quartz_test", WS_OVERLAPPEDWINDOW, 0, 0,
             rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, NULL, NULL);
     if (!(device = create_device(window)))
-        goto out;
+    {
+        DestroyWindow(window);
+        return;
+    }
+
+    filter = create_vmr9(VMR9Mode_Renderless);
+    IBaseFilter_QueryInterface(filter, &IID_IVMRSurfaceAllocatorNotify9, (void **)&notify);
 
     hr = IVMRSurfaceAllocatorNotify9_SetD3DDevice(notify, device, MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY));
     if (hr == E_NOINTERFACE)
@@ -3042,6 +3046,7 @@ static void test_renderless_formats(void)
     allocator_notify = notify;
 
     testfilter_init(&source);
+    graph = create_graph();
     IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
     IFilterGraph2_AddFilter(graph, filter, NULL);
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);




More information about the wine-cvs mailing list