Vitaliy Margolen : d3dx: VertexBuffer should keep reference to the parent device object.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 3 14:46:12 CDT 2006


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

Author: Vitaliy Margolen <wine-patch at kievinfo.com>
Date:   Sun Apr  2 13:24:00 2006 -0600

d3dx: VertexBuffer should keep reference to the parent device object.

---

 dlls/d3d8/d3d8_private.h |    3 +++
 dlls/d3d8/device.c       |    2 ++
 dlls/d3d8/vertexbuffer.c |    1 +
 dlls/d3d9/d3d9_private.h |    3 +++
 dlls/d3d9/vertexbuffer.c |    3 +++
 5 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 31fe04c..c0f8eb0 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -295,6 +295,9 @@ struct IDirect3DVertexBuffer8Impl
 
     /* IDirect3DResource8 fields */
     IWineD3DVertexBuffer             *wineD3DVertexBuffer;
+
+    /* Parent reference */
+    LPDIRECT3DDEVICE8                 parentDevice;
 };
 
 /* --------------------- */
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index f21a5dc..720bc4a 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -418,6 +418,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_Crea
         HeapFree(GetProcessHeap(), 0, object);
         *ppVertexBuffer = NULL;
     } else {
+        IUnknown_AddRef(iface);
+        object->parentDevice = iface;
         *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER8) object;
     }
     return hrc;
diff --git a/dlls/d3d8/vertexbuffer.c b/dlls/d3d8/vertexbuffer.c
index 5ca8318..fc22936 100644
--- a/dlls/d3d8/vertexbuffer.c
+++ b/dlls/d3d8/vertexbuffer.c
@@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DVertexBuffer8Impl_
 
     if (ref == 0) {
         IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
+        IUnknown_Release(This->parentDevice);
         HeapFree(GetProcessHeap(), 0, This);
     }
 
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 916cff2..02c15eb 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -353,6 +353,9 @@ typedef struct IDirect3DVertexBuffer9Imp
 
     /* IDirect3DResource9 fields */
     IWineD3DVertexBuffer   *wineD3DVertexBuffer;
+
+    /* Parent reference */
+    LPDIRECT3DDEVICE9       parentDevice;
 } IDirect3DVertexBuffer9Impl;
 
 /* --------------------- */
diff --git a/dlls/d3d9/vertexbuffer.c b/dlls/d3d9/vertexbuffer.c
index d679c14..b2c43a4 100644
--- a/dlls/d3d9/vertexbuffer.c
+++ b/dlls/d3d9/vertexbuffer.c
@@ -58,6 +58,7 @@ ULONG WINAPI IDirect3DVertexBuffer9Impl_
 
     if (ref == 0) {
         IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
+        IUnknown_Release(This->parentDevice);
         HeapFree(GetProcessHeap(), 0, This);
     }
     return ref;
@@ -180,6 +181,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_Crea
         FIXME("(%p) call to IWineD3DDevice_CreateVertexBuffer failed\n", This);
         HeapFree(GetProcessHeap(), 0, object);
     } else {
+        IUnknown_AddRef(iface);
+        object->parentDevice = iface;
         TRACE("(%p) : Created vertex buffer %p\n", This, object);
         *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
     }




More information about the wine-cvs mailing list