[PATCH 4/5] ddraw: Verify the viewport belongs to the device in IDirect3DDeviceImpl_3_SetCurrentViewport().

Henri Verbeet hverbeet at codeweavers.com
Mon Apr 18 17:07:59 CDT 2011


---
 dlls/ddraw/device.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 2c85659..80ee926 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);
-- 
1.7.3.4




More information about the wine-patches mailing list