diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index c0b72f9710d..bdada7b3e1b 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -37,16 +37,17 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface 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); diff --git a/dlls/wined3d/indexbuffer.c b/dlls/wined3d/indexbuffer.c index 1d6493a415d..03c969926d4 100644 --- a/dlls/wined3d/indexbuffer.c +++ b/dlls/wined3d/indexbuffer.c @@ -38,16 +38,16 @@ HRESULT WINAPI IWineD3DIndexBufferImpl_QueryInterface(IWineD3DIndexBuffer *iface 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); diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 5122c55fba2..73f1e0d050e 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -36,15 +36,15 @@ HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFI 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); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 8381f03e546..1b706e6018b 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -38,16 +38,16 @@ HRESULT WINAPI IWineD3DSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID 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); diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c index 02a9493cf33..b8abcfbcc83 100644 --- a/dlls/wined3d/vertexbuffer.c +++ b/dlls/wined3d/vertexbuffer.c @@ -38,16 +38,16 @@ HRESULT WINAPI IWineD3DVertexBufferImpl_QueryInterface(IWineD3DVertexBuffer *ifa 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);