ddraw/tests: Don't destroy the background material until the viewport is done with it in test_material() (Valgrind).

This commit is contained in:
Henri Verbeet 2015-04-29 17:27:36 +02:00 committed by Alexandre Julliard
parent 4c5276042d
commit 6569337cb7
2 changed files with 8 additions and 8 deletions

View File

@ -5195,10 +5195,10 @@ static void test_p8_rgb_blit(void)
static void test_material(void)
{
IDirect3DMaterial *background, *material;
IDirect3DExecuteBuffer *execute_buffer;
D3DMATERIALHANDLE mat_handle, tmp;
D3DEXECUTEBUFFERDESC exec_desc;
IDirect3DMaterial *material;
IDirect3DViewport *viewport;
IDirect3DDevice *device;
IDirectDrawSurface *rt;
@ -5245,11 +5245,10 @@ static void test_material(void)
hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&rt);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
material = create_diffuse_material(device, 0.0f, 0.0f, 1.0f, 1.0f);
background = create_diffuse_material(device, 0.0f, 0.0f, 1.0f, 1.0f);
viewport = create_viewport(device, 0, 0, 640, 480);
viewport_set_background(device, viewport, material);
viewport_set_background(device, viewport, background);
destroy_material(material);
material = create_emissive_material(device, 0.0f, 1.0f, 0.0f, 0.0f);
hr = IDirect3DMaterial_GetHandle(material, device, &mat_handle);
ok(SUCCEEDED(hr), "Failed to get material handle, hr %#x.\n", hr);
@ -5342,6 +5341,7 @@ static void test_material(void)
IDirect3DExecuteBuffer_Release(execute_buffer);
destroy_viewport(device, viewport);
destroy_material(background);
destroy_material(material);
IDirectDrawSurface_Release(rt);
refcount = IDirect3DDevice_Release(device);

View File

@ -6247,8 +6247,8 @@ static void test_p8_rgb_blit(void)
static void test_material(void)
{
IDirect3DMaterial2 *background, *material;
D3DMATERIALHANDLE mat_handle, tmp;
IDirect3DMaterial2 *material;
IDirect3DViewport2 *viewport;
IDirect3DDevice2 *device;
IDirectDrawSurface *rt;
@ -6293,13 +6293,12 @@ static void test_material(void)
hr = IDirect3DDevice2_GetRenderTarget(device, &rt);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
material = create_diffuse_material(device, 0.0f, 0.0f, 1.0f, 1.0f);
background = create_diffuse_material(device, 0.0f, 0.0f, 1.0f, 1.0f);
viewport = create_viewport(device, 0, 0, 640, 480);
viewport_set_background(device, viewport, material);
viewport_set_background(device, viewport, background);
hr = IDirect3DDevice2_SetCurrentViewport(device, viewport);
ok(SUCCEEDED(hr), "Failed to set current viewport, hr %#x.\n", hr);
destroy_material(material);
material = create_emissive_material(device, 0.0f, 1.0f, 0.0f, 0.0f);
hr = IDirect3DMaterial2_GetHandle(material, device, &mat_handle);
ok(SUCCEEDED(hr), "Failed to get material handle, hr %#x.\n", hr);
@ -6377,6 +6376,7 @@ static void test_material(void)
ok(compare_color(color, 0x00000000, 1), "Got unexpected color 0x%08x.\n", color);
destroy_viewport(device, viewport);
destroy_material(background);
destroy_material(material);
IDirectDrawSurface_Release(rt);
refcount = IDirect3DDevice2_Release(device);