On 14.02.2017 22:56, Stefan Dösinger wrote:
This fixes compilation on Visual Studio with native compiler exceptions.
Signed-off-by: Stefan Dösinger stefandoesinger@gmx.at
While you are just at it, please note that this code also contains a leak when the exception is triggered. Actually, it would probably be easier to test if the pointer is writeable in advance, and exit early without creating the surface at all.
dlls/ddraw/ddraw.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 254dae7..54f3817 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2836,11 +2836,13 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 * if (FAILED(hr)) { *surface = NULL;
break; }
*surface = &impl->IDirectDrawSurface7_iface;
IDirectDraw7_AddRef(iface);
impl->ifaceToRelease = (IUnknown *)iface;
else
{
*surface = &impl->IDirectDrawSurface7_iface;
IDirectDraw7_AddRef(iface);
impl->ifaceToRelease = (IUnknown *)iface;
} __EXCEPT_PAGE_FAULT {}
@@ -2898,11 +2900,13 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, if (FAILED(hr)) { *surface = NULL;
break; }
*surface = &impl->IDirectDrawSurface4_iface;
IDirectDraw4_AddRef(iface);
impl->ifaceToRelease = (IUnknown *)iface;
else
{
*surface = &impl->IDirectDrawSurface4_iface;
IDirectDraw4_AddRef(iface);
impl->ifaceToRelease = (IUnknown *)iface;
} __EXCEPT_PAGE_FAULT {}
@@ -2962,10 +2966,12 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, if (FAILED(hr)) { *surface = NULL;
break; }
*surface = &impl->IDirectDrawSurface_iface;
impl->ifaceToRelease = NULL;
else
{
*surface = &impl->IDirectDrawSurface_iface;
impl->ifaceToRelease = NULL;
} __EXCEPT_PAGE_FAULT {}
@@ -3022,10 +3028,12 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, if (FAILED(hr)) { *surface = NULL;
break; }
*surface = &impl->IDirectDrawSurface_iface;
impl->ifaceToRelease = NULL;
else
{
*surface = &impl->IDirectDrawSurface_iface;
impl->ifaceToRelease = NULL;
} __EXCEPT_PAGE_FAULT {}