Vitaliy Margolen : d3d9: VertexDeclaration and VertexShader should keep reference to the parent device object .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 12 04:52:10 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 4a25828c0d8d7fa08793027f4c4d2ba14dc5407d
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=4a25828c0d8d7fa08793027f4c4d2ba14dc5407d

Author: Vitaliy Margolen <wine-patch at kievinfo.com>
Date:   Tue Apr 11 22:09:27 2006 -0600

d3d9: VertexDeclaration and VertexShader should keep reference to the parent device object.

---

 dlls/d3d9/d3d9_private.h      |    4 ++++
 dlls/d3d9/vertexdeclaration.c |    3 +++
 dlls/d3d9/vertexshader.c      |    3 +++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 02c15eb..797eb4b 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -541,6 +541,8 @@ typedef struct IDirect3DVertexDeclaratio
   /* IDirect3DVertexDeclaration9 fields */
   IWineD3DVertexDeclaration *wineD3DVertexDeclaration;
   
+  /* Parent reference */
+  LPDIRECT3DDEVICE9 parentDevice;
 } IDirect3DVertexDeclaration9Impl;
 
 /* ---------------------- */
@@ -563,6 +565,8 @@ typedef struct IDirect3DVertexShader9Imp
   /* IDirect3DVertexShader9 fields */
   IWineD3DVertexShader *wineD3DVertexShader;
 
+  /* Parent reference */
+  LPDIRECT3DDEVICE9 parentDevice;
 } IDirect3DVertexShader9Impl;
 
 /* --------------------- */
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c
index ef8ed54..1e1b7b1 100644
--- a/dlls/d3d9/vertexdeclaration.c
+++ b/dlls/d3d9/vertexdeclaration.c
@@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DVertexDeclaration9
 
     if (ref == 0) {
         IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration);
+        IUnknown_Release(This->parentDevice);
         HeapFree(GetProcessHeap(), 0, This);
     }
     return ref;
@@ -129,6 +130,8 @@ HRESULT  WINAPI  IDirect3DDevice9Impl_Cr
         FIXME("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This);
         HeapFree(GetProcessHeap(), 0, object);
     } else {
+        IUnknown_AddRef(iface);
+        object->parentDevice = iface;
         *ppDecl = (LPDIRECT3DVERTEXDECLARATION9) object;
          TRACE("(%p) : Created vertex declatanio %p\n", This, object);
     }
diff --git a/dlls/d3d9/vertexshader.c b/dlls/d3d9/vertexshader.c
index 034b097..050e387 100644
--- a/dlls/d3d9/vertexshader.c
+++ b/dlls/d3d9/vertexshader.c
@@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DVertexShader9Impl_
 
     if (ref == 0) {
         IWineD3DVertexShader_Release(This->wineD3DVertexShader);
+        IUnknown_Release(This->parentDevice);
         HeapFree(GetProcessHeap(), 0, This);
     }
     return ref;
@@ -122,6 +123,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_Crea
         FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n");
         HeapFree(GetProcessHeap(), 0, object);
     }else{
+        IUnknown_AddRef(iface);
+        object->parentDevice = iface;
         *ppShader = (IDirect3DVertexShader9 *)object;
         TRACE("(%p) : Created vertex shader %p\n", This, object);
     }




More information about the wine-cvs mailing list