Commit fc134207 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

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

parent 605574be
...@@ -295,6 +295,9 @@ struct IDirect3DVertexBuffer8Impl ...@@ -295,6 +295,9 @@ struct IDirect3DVertexBuffer8Impl
/* IDirect3DResource8 fields */ /* IDirect3DResource8 fields */
IWineD3DVertexBuffer *wineD3DVertexBuffer; IWineD3DVertexBuffer *wineD3DVertexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
}; };
/* --------------------- */ /* --------------------- */
......
...@@ -418,6 +418,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(LPDIRECT3DDEVICE8 iface, ...@@ -418,6 +418,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(LPDIRECT3DDEVICE8 iface,
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
*ppVertexBuffer = NULL; *ppVertexBuffer = NULL;
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER8) object; *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER8) object;
} }
return hrc; return hrc;
......
...@@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) { ...@@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) {
if (ref == 0) { if (ref == 0) {
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer); IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
......
...@@ -353,6 +353,9 @@ typedef struct IDirect3DVertexBuffer9Impl ...@@ -353,6 +353,9 @@ typedef struct IDirect3DVertexBuffer9Impl
/* IDirect3DResource9 fields */ /* IDirect3DResource9 fields */
IWineD3DVertexBuffer *wineD3DVertexBuffer; IWineD3DVertexBuffer *wineD3DVertexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DVertexBuffer9Impl; } IDirect3DVertexBuffer9Impl;
/* --------------------- */ /* --------------------- */
......
...@@ -58,6 +58,7 @@ ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 iface) { ...@@ -58,6 +58,7 @@ ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 iface) {
if (ref == 0) { if (ref == 0) {
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer); IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;
...@@ -180,6 +181,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface, ...@@ -180,6 +181,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
FIXME("(%p) call to IWineD3DDevice_CreateVertexBuffer failed\n", This); FIXME("(%p) call to IWineD3DDevice_CreateVertexBuffer failed\n", This);
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
TRACE("(%p) : Created vertex buffer %p\n", This, object); TRACE("(%p) : Created vertex buffer %p\n", This, object);
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object; *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment