Stefan Dösinger : d3d9: AddRef the device in IDirect3DVertexDeclaration9::AddRef.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Apr 12 09:59:53 CDT 2007
Module: wine
Branch: master
Commit: 2db7691ec8930e64884ae86dc74deca849982052
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2db7691ec8930e64884ae86dc74deca849982052
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Sat Apr 7 22:56:42 2007 +0200
d3d9: AddRef the device in IDirect3DVertexDeclaration9::AddRef.
---
dlls/d3d9/vertexdeclaration.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c
index 315107e..84d4359 100644
--- a/dlls/d3d9/vertexdeclaration.c
+++ b/dlls/d3d9/vertexdeclaration.c
@@ -202,6 +202,10 @@ static ULONG WINAPI IDirect3DVertexDeclaration9Impl_AddRef(LPDIRECT3DVERTEXDECLA
TRACE("(%p) : AddRef from %d\n", This, ref - 1);
+ if(ref == 1) {
+ IUnknown_AddRef(This->parentDevice);
+ }
+
return ref;
}
@@ -324,7 +328,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
}
object->lpVtbl = &Direct3DVertexDeclaration9_Vtbl;
- object->ref = 1;
+ object->ref = 0;
object->elements = HeapAlloc(GetProcessHeap(), 0, element_count * sizeof(D3DVERTEXELEMENT9));
if (!object->elements) {
@@ -347,9 +351,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
HeapFree(GetProcessHeap(), 0, object->elements);
HeapFree(GetProcessHeap(), 0, object);
} else {
- IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppDecl = (LPDIRECT3DVERTEXDECLARATION9) object;
+ IUnknown_AddRef(*ppDecl);
TRACE("(%p) : Created vertex declaration %p\n", This, object);
}
return hr;
More information about the wine-cvs
mailing list