ddraw: Don't crash if writing out a new ddraw7 surface segfaults.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1850ac5770
commit
c9e29bff7b
|
@ -2814,15 +2814,23 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
|
|||
|
||||
hr = ddraw_surface_create(ddraw, surface_desc, &impl, outer_unknown, 7);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
*surface = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = &impl->IDirectDrawSurface7_iface;
|
||||
IDirectDraw7_AddRef(iface);
|
||||
impl->ifaceToRelease = (IUnknown *)iface;
|
||||
__TRY
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
*surface = NULL;
|
||||
break;
|
||||
}
|
||||
*surface = &impl->IDirectDrawSurface7_iface;
|
||||
IDirectDraw7_AddRef(iface);
|
||||
impl->ifaceToRelease = (IUnknown *)iface;
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
hr = E_INVALIDARG;
|
||||
}
|
||||
__ENDTRY;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -1994,6 +1994,8 @@ static void test_surface_qi(void)
|
|||
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
||||
surface_desc.dwWidth = 512;
|
||||
surface_desc.dwHeight = 512;
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, (IDirectDrawSurface7 **)0xdeadbeef, NULL);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue