d3drm: Fix reference leak in d3drm_viewport2_Clear().

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jeff Smith 2019-07-01 12:17:29 -05:00 committed by Alexandre Julliard
parent 9ade30d0ce
commit 8fb032916d
2 changed files with 5 additions and 0 deletions

View File

@ -6739,10 +6739,12 @@ static void test_viewport_clear1(void)
ret_color = IDirect3DRMFrame_GetSceneBackground(camera1);
ok(ret_color == 0xff00ff00, "Expected scene color returned == 0xff00ff00, got %#x.\n", ret_color);
CHECK_REFCOUNT(frame1, 1);
hr = IDirect3DRMViewport_Clear(viewport1);
ok(SUCCEEDED(hr), "Cannot clear viewport (hr = %#x).\n", hr);
ret_color = get_surface_color(surface, 320, 240);
ok(compare_color(ret_color, 0x00ffffff, 1), "Got unexpected color 0x%08x.\n", ret_color);
CHECK_REFCOUNT(frame1, 1);
hr = IDirect3DRMFrame_SetSceneBackgroundRGB(frame1, 0.0f, 0.0f, 1.0f);
ok(SUCCEEDED(hr), "Cannot set scene background RGB (hr = %#x)\n", hr);
@ -6942,10 +6944,12 @@ static void test_viewport_clear2(void)
ret_color = IDirect3DRMFrame3_GetSceneBackground(camera3);
ok(ret_color == 0xff00ff00, "Expected scene color returned == 0xff00ff00, got %#x.\n", ret_color);
CHECK_REFCOUNT(frame3, 1);
hr = IDirect3DRMViewport2_Clear(viewport2, D3DRMCLEAR_ALL);
ok(SUCCEEDED(hr), "Cannot clear viewport (hr = %#x).\n", hr);
ret_color = get_surface_color(surface, 320, 240);
ok(compare_color(ret_color, 0x00ffffff, 1), "Got unexpected color 0x%08x.\n", ret_color);
CHECK_REFCOUNT(frame3, 1);
hr = IDirect3DRMViewport2_GetDirect3DViewport(viewport2, &d3d_viewport);
ok(SUCCEEDED(hr), "Cannot get IDirect3DViewport interface (hr = %#x).\n", hr);

View File

@ -50,6 +50,7 @@ static HRESULT d3drm_update_background_material(struct d3drm_viewport *viewport)
if (FAILED(hr = IDirect3DRMFrame_GetScene(viewport->camera, &root_frame)))
return hr;
color = IDirect3DRMFrame_GetSceneBackground(root_frame);
IDirect3DRMFrame_Release(root_frame);
memset(&mat, 0, sizeof(mat));
mat.dwSize = sizeof(mat);