wined3d: Fixed swapchain context NULL ptr checks.

This commit is contained in:
Marcus Meissner 2007-05-12 10:22:42 +02:00 committed by Alexandre Julliard
parent d9c120490f
commit 4b9fedbb06

View File

@ -1366,15 +1366,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
/** FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat **/ /** FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat **/
object->context = HeapAlloc(GetProcessHeap(), 0, sizeof(object->context)); object->context = HeapAlloc(GetProcessHeap(), 0, sizeof(object->context));
if(!object->context) { if(!object->context)
} return E_OUTOFMEMORY;
object->num_contexts = 1; object->num_contexts = 1;
ENTER_GL(); ENTER_GL();
object->context[0] = CreateContext(This, (IWineD3DSurfaceImpl *) object->frontBuffer, display, object->win); object->context[0] = CreateContext(This, (IWineD3DSurfaceImpl *) object->frontBuffer, display, object->win);
LEAVE_GL(); LEAVE_GL();
if (!object->context) { if (!object->context[0]) {
ERR("Failed to create a new context\n"); ERR("Failed to create a new context\n");
hr = WINED3DERR_NOTAVAILABLE; hr = WINED3DERR_NOTAVAILABLE;
goto error; goto error;
@ -1517,9 +1517,8 @@ error:
HeapFree(GetProcessHeap(), 0, object->backBuffer); HeapFree(GetProcessHeap(), 0, object->backBuffer);
object->backBuffer = NULL; object->backBuffer = NULL;
} }
if(object->context) { if(object->context[0])
DestroyContext(This, object->context[0]); DestroyContext(This, object->context[0]);
}
if(object->frontBuffer) { if(object->frontBuffer) {
IWineD3DSurface_GetParent(object->frontBuffer, &bufferParent); IWineD3DSurface_GetParent(object->frontBuffer, &bufferParent);
IUnknown_Release(bufferParent); /* once for the get parent */ IUnknown_Release(bufferParent); /* once for the get parent */