[PATCH 1/3] d3drm: Store reference to render target in IDirect3DRM*::CreateDeviceFromD3D.

Aaryaman Vasishta jem456.vasishta at gmail.com
Mon Aug 8 20:16:05 CDT 2016


Signed-off-by: Aaryaman Vasishta <jem456.vasishta at gmail.com>
---
 dlls/d3drm/device.c      | 5 ++++-
 dlls/d3drm/tests/d3drm.c | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/d3drm/device.c b/dlls/d3drm/device.c
index a8d646b..9a53f7c 100644
--- a/dlls/d3drm/device.c
+++ b/dlls/d3drm/device.c
@@ -239,14 +239,17 @@ static HRESULT d3drm_device_set_ddraw_device_d3d(struct d3drm_device *device, ID
 
     desc.dwSize = sizeof(desc);
     hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc);
-    IDirectDrawSurface_Release(surface);
     if (FAILED(hr))
+    {
+        IDirectDrawSurface_Release(surface);
         return hr;
+    }
 
     device->ddraw = ddraw;
     device->width = desc.dwWidth;
     device->height = desc.dwHeight;
     device->device = d3d_device;
+    device->render_target = surface;
 
     return hr;
 }
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c
index 1abaed5..2c82ecb 100644
--- a/dlls/d3drm/tests/d3drm.c
+++ b/dlls/d3drm/tests/d3drm.c
@@ -4572,7 +4572,7 @@ static void test_create_device_from_d3d1(void)
     ref3 = get_refcount((IUnknown *)d3drm1);
     ok(ref3 > ref2, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3);
     ref3 = get_refcount((IUnknown *)temp_d3ddevice1);
-    ok(ref3 == device_ref2, "Expected ref3 == device_ref2, got ref3 = %u, device_ref2 = %u.\n", ref3, device_ref2);
+    todo_wine ok(ref3 == device_ref2, "Expected ref3 == device_ref2, got ref3 = %u, device_ref2 = %u.\n", ref3, device_ref2);
     ref3 = get_refcount((IUnknown *)temp_d3d1);
     todo_wine ok(ref3 < d3d_ref2, "Expected ref3 < d3d_ref2, got ref3 = %u, d3d_ref2 = %u.\n", ref3, d3d_ref2);
     /* Release leaked references */
-- 
2.3.2 (Apple Git-55)




More information about the wine-patches mailing list