WINED3D: Release the correct vertexdeclaration in IWineD3DDeviceImpl_SetVertexDeclaration

H. Verbeet hverbeet at gmail.com
Sun Feb 5 13:49:42 CST 2006


When setting a new vertexdeclaration,
IWineD3DDeviceImpl_SetVertexDeclaration releases the vertex
declaration in updateStateblock. However, it does this after the
vertex declaration got changed. This patch should be applied after the
previous one (wined3d_recording_refcount.diff.txt).

Changelog:
  - Release the correct vertexdeclaration in
IWineD3DDeviceImpl_SetVertexDeclaration
-------------- next part --------------
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6277ff5..6b1d3cf 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3773,6 +3773,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetSci
 
 HRESULT WINAPI IWineD3DDeviceImpl_SetVertexDeclaration(IWineD3DDevice* iface, IWineD3DVertexDeclaration* pDecl) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
+    IWineD3DVertexDeclaration *oldDecl = This->updateStateBlock->vertexDecl;
 
     TRACE("(%p) : pDecl=%p\n", This, pDecl);
 
@@ -3787,8 +3788,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVer
     if (NULL != pDecl) {
         IWineD3DVertexDeclaration_AddRef(pDecl);
     }
-    if (NULL != This->updateStateBlock->vertexDecl) {
-      IWineD3DVertexDeclaration_Release(This->updateStateBlock->vertexDecl);
+    if (NULL != oldDecl) {
+        IWineD3DVertexDeclaration_Release(oldDecl);
     }
     return D3D_OK;
 }



More information about the wine-patches mailing list