From 9edeb22c345904daa68b8d99b3d4530c11c6345c Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 19 Apr 2011 00:07:59 +0200 Subject: [PATCH] ddraw: Verify the viewport belongs to the device in IDirect3DDeviceImpl_3_SetCurrentViewport(). --- dlls/ddraw/device.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 2c85659319a..80ee926b33b 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -1742,7 +1742,12 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface, return D3D_OK; } - /* Should check if the viewport was added or not */ + if (vp->active_device != This) + { + WARN("Viewport %p active device is %p.\n", vp, vp->active_device); + LeaveCriticalSection(&ddraw_cs); + return DDERR_INVALIDPARAMS; + } /* Release previous viewport and AddRef the new one */ if (This->current_viewport) @@ -1757,7 +1762,6 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface, This->current_viewport = vp; /* Activate this viewport */ - This->current_viewport->active_device = This; viewport_activate(This->current_viewport, FALSE); LeaveCriticalSection(&ddraw_cs);