[WINE3D] Interlocked cleanup
Joris Huizer
jorishuizer at planet.nl
Thu Jan 13 06:22:51 CST 2005
-------------- next part --------------
Index: dlls/wined3d/basetexture.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/basetexture.c,v
retrieving revision 1.2
diff -u -r1.2 basetexture.c
--- dlls/wined3d/basetexture.c 9 Jan 2005 17:37:02 -0000 1.2
+++ dlls/wined3d/basetexture.c 13 Jan 2005 12:22:54 -0000
@@ -37,16 +37,17 @@
ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface) {
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
+ ULONG ref = InterlockedIncrement(&This->resource.ref);
+
+ TRACE("(%p) : AddRef increasing from %ld\n", This,ref - 1);
IUnknown_AddRef(This->resource.parent);
- return InterlockedIncrement(&This->resource.ref);
+ return ref;
}
ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface) {
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- ULONG ref;
- TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
- ref = InterlockedDecrement(&This->resource.ref);
+ ULONG ref = InterlockedDecrement(&This->resource.ref);
+ TRACE("(%p) : Releasing from %ld\n", This, ref + 1);
if (ref == 0) {
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
HeapFree(GetProcessHeap(), 0, This);
Index: dlls/wined3d/indexbuffer.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/indexbuffer.c,v
retrieving revision 1.4
diff -u -r1.4 indexbuffer.c
--- dlls/wined3d/indexbuffer.c 9 Jan 2005 17:37:02 -0000 1.4
+++ dlls/wined3d/indexbuffer.c 13 Jan 2005 12:22:54 -0000
@@ -38,16 +38,16 @@
ULONG WINAPI IWineD3DIndexBufferImpl_AddRef(IWineD3DIndexBuffer *iface) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
- TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
+ ULONG ref = InterlockedIncrement(&This->resource.ref);
+ TRACE("(%p) : AddRef increasing from %ld\n", This, ref - 1);
IUnknown_AddRef(This->resource.parent);
- return InterlockedIncrement(&This->resource.ref);
+ return ref
}
ULONG WINAPI IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer *iface) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
- ULONG ref;
- TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
- ref = InterlockedDecrement(&This->resource.ref);
+ ULONG ref = InterlockedDecrement(&This->resource.ref);
+ TRACE("(%p) : Releasing from %ld\n", This, ref + 1);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
Index: dlls/wined3d/resource.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/resource.c,v
retrieving revision 1.4
diff -u -r1.4 resource.c
--- dlls/wined3d/resource.c 9 Jan 2005 17:37:02 -0000 1.4
+++ dlls/wined3d/resource.c 13 Jan 2005 12:22:54 -0000
@@ -36,15 +36,15 @@
ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
- TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
- return InterlockedIncrement(&This->resource.ref);
+ ULONG ref = InterlockedIncrement(&This->resource.ref);
+ TRACE("(%p) : AddRef increasing from %ld\n", This, ref - 1);
+ return ref;
}
ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
- ULONG ref;
- TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
- ref = InterlockedDecrement(&This->resource.ref);
+ ULONG ref = InterlockedDecrement(&This->resource.ref);
+ TRACE("(%p) : Releasing from %ld\n", This, ref + 1);
if (ref == 0) {
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
HeapFree(GetProcessHeap(), 0, This);
Index: dlls/wined3d/surface.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/surface.c,v
retrieving revision 1.1
diff -u -r1.1 surface.c
--- dlls/wined3d/surface.c 9 Jan 2005 17:37:02 -0000 1.1
+++ dlls/wined3d/surface.c 13 Jan 2005 12:22:55 -0000
@@ -38,16 +38,16 @@
ULONG WINAPI IWineD3DSurfaceImpl_AddRef(IWineD3DSurface *iface) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
- TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
+ ULONG ref = InterlockedIncrement(&This->resource.ref);
+ TRACE("(%p) : AddRef increasing from %ld\n", This,ref - 1);
IUnknown_AddRef(This->resource.parent);
- return InterlockedIncrement(&This->resource.ref);
+ return ref
}
ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
- ULONG ref;
- TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
- ref = InterlockedDecrement(&This->resource.ref);
+ ULONG ref = InterlockedDecrement(&This->resource.ref);
+ TRACE("(%p) : Releasing from %ld\n", This, ref + 1);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
Index: dlls/wined3d/vertexbuffer.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/vertexbuffer.c,v
retrieving revision 1.6
diff -u -r1.6 vertexbuffer.c
--- dlls/wined3d/vertexbuffer.c 9 Jan 2005 17:37:02 -0000 1.6
+++ dlls/wined3d/vertexbuffer.c 13 Jan 2005 12:22:55 -0000
@@ -38,16 +38,16 @@
ULONG WINAPI IWineD3DVertexBufferImpl_AddRef(IWineD3DVertexBuffer *iface) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
- TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
+ ULONG ref = InterlockedIncrement(&This->resource.ref);
+ TRACE("(%p) : AddRef increasing from %ld\n", This, ref - 1);
IUnknown_AddRef(This->resource.parent);
- return InterlockedIncrement(&This->resource.ref);
+ return ref;
}
ULONG WINAPI IWineD3DVertexBufferImpl_Release(IWineD3DVertexBuffer *iface) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
- ULONG ref;
- TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
- ref = InterlockedDecrement(&This->resource.ref);
+ ULONG ref = InterlockedDecrement(&This->resource.ref);
+ TRACE("(%p) : Releasing from %ld\n", This, ref + 1);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
More information about the wine-patches
mailing list