Henri Verbeet : ddraw: Verify the viewport belongs to the device in IDirect3DDeviceImpl_3_SetCurrentViewport ().

Alexandre Julliard julliard at winehq.org
Tue Apr 19 12:08:17 CDT 2011


Module: wine
Branch: master
Commit: 9edeb22c345904daa68b8d99b3d4530c11c6345c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9edeb22c345904daa68b8d99b3d4530c11c6345c

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Apr 19 00:07:59 2011 +0200

ddraw: Verify the viewport belongs to the device in IDirect3DDeviceImpl_3_SetCurrentViewport().

---

 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);




More information about the wine-cvs mailing list