mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
- use Interlocked* functions in AddRef and Release.
- store the result of the Interlocked functions and use only this.
This commit is contained in:
parent
617dc088a5
commit
202b340a51
@ -260,16 +260,22 @@ ULONG WINAPI
|
||||
Main_IDirect3DDeviceImpl_7_3T_2T_1T_AddRef(LPDIRECT3DDEVICE7 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
|
||||
return ++(This->ref);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (!--(This->ref)) {
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
int i;
|
||||
/* Release texture associated with the device */
|
||||
for (i = 0; i < MAX_TEXTURES; i++) {
|
||||
@ -280,7 +286,7 @@ Main_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
@ -381,9 +381,11 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
|
||||
IDirect3DDeviceGLImpl *glThis = (IDirect3DDeviceGLImpl *) This;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (!--(This->ref)) {
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
int i;
|
||||
IDirectDrawSurfaceImpl *surface = This->surface, *surf;
|
||||
|
||||
@ -442,7 +444,7 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
@ -519,16 +519,22 @@ ULONG WINAPI
|
||||
Main_IDirect3DExecuteBufferImpl_1_AddRef(LPDIRECT3DEXECUTEBUFFER iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
|
||||
FIXME("(%p/%p)->()incrementing from %lu.\n", This, iface, This->ref );
|
||||
return ++(This->ref);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
FIXME("(%p/%p)->()incrementing from %lu.\n", This, iface, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_IDirect3DExecuteBufferImpl_1_Release(LPDIRECT3DEXECUTEBUFFER iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface);
|
||||
TRACE("(%p/%p)->()decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (!--(This->ref)) {
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->()decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
if ((This->desc.lpData != NULL) && This->need_free)
|
||||
HeapFree(GetProcessHeap(),0,This->desc.lpData);
|
||||
HeapFree(GetProcessHeap(),0,This->vertex_data);
|
||||
@ -537,7 +543,7 @@ Main_IDirect3DExecuteBufferImpl_1_Release(LPDIRECT3DEXECUTEBUFFER iface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
@ -53,20 +53,26 @@ ULONG WINAPI
|
||||
Main_IDirect3DLightImpl_1_AddRef(LPDIRECT3DLIGHT iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
|
||||
return ++(This->ref);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_IDirect3DLightImpl_1_Release(LPDIRECT3DLIGHT iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (!--(This->ref)) {
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
@ -191,14 +197,16 @@ GL_IDirect3DLightImpl_1_Release(LPDIRECT3DLIGHT iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
|
||||
IDirect3DLightGLImpl *glThis = (IDirect3DLightGLImpl *) This;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (!--(This->ref)) {
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
((IDirect3DGLImpl *) This->d3d->d3d_private)->light_released(This->d3d, glThis->light_num);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
||||
|
@ -85,20 +85,26 @@ ULONG WINAPI
|
||||
Main_IDirect3DMaterialImpl_3_2T_1T_AddRef(LPDIRECT3DMATERIAL3 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
|
||||
return ++(This->ref);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_IDirect3DMaterialImpl_3_2T_1T_Release(LPDIRECT3DMATERIAL3 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (!--(This->ref)) {
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
@ -73,21 +73,27 @@ ULONG WINAPI
|
||||
Main_IDirect3DVertexBufferImpl_7_1T_AddRef(LPDIRECT3DVERTEXBUFFER7 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
|
||||
return ++(This->ref);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_IDirect3DVertexBufferImpl_7_1T_Release(LPDIRECT3DVERTEXBUFFER7 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (--(This->ref) == 0) {
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This->vertices);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
@ -126,20 +126,26 @@ ULONG WINAPI
|
||||
Main_IDirect3DViewportImpl_3_2_1_AddRef(LPDIRECT3DVIEWPORT3 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
|
||||
return ++(This->ref);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI
|
||||
Main_IDirect3DViewportImpl_3_2_1_Release(LPDIRECT3DVIEWPORT3 iface)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
|
||||
if (!--(This->ref)) {
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,14 +114,16 @@ void Main_DirectDrawClipper_ForceDestroy(IDirectDrawClipperImpl* This)
|
||||
|
||||
ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) {
|
||||
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
|
||||
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
if (--This->ref == 0)
|
||||
TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1);
|
||||
|
||||
if (ref == 0)
|
||||
{
|
||||
Main_DirectDrawClipper_Destroy(This);
|
||||
return 0;
|
||||
}
|
||||
else return This->ref;
|
||||
else return ref;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -211,7 +213,7 @@ HRESULT WINAPI Main_DirectDrawClipper_QueryInterface(
|
||||
|| IsEqualGUID(&IID_IDirectDrawClipper, riid))
|
||||
{
|
||||
*ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper);
|
||||
++This->ref;
|
||||
InterlockedIncrement(&This->ref);
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
@ -223,8 +225,11 @@ HRESULT WINAPI Main_DirectDrawClipper_QueryInterface(
|
||||
ULONG WINAPI Main_DirectDrawClipper_AddRef( LPDIRECTDRAWCLIPPER iface )
|
||||
{
|
||||
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
|
||||
TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
|
||||
return ++This->ref;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI Main_DirectDrawClipper_GetHWnd(
|
||||
|
@ -149,17 +149,18 @@ void Main_DirectDraw_final_release(IDirectDrawImpl* This)
|
||||
|
||||
ULONG WINAPI Main_DirectDraw_AddRef(LPDIRECTDRAW7 iface) {
|
||||
IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
|
||||
TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
return ++This->ref;
|
||||
TRACE("(%p)->() incrementing from %lu.\n", This, ref -1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DirectDraw_Release(LPDIRECTDRAW7 iface) {
|
||||
ULONG ref;
|
||||
IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
|
||||
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
ref = --This->ref;
|
||||
TRACE("(%p)->() decrementing from %lu.\n", This, ref +1);
|
||||
|
||||
if (ref == 0)
|
||||
{
|
||||
|
@ -208,21 +208,26 @@ ULONG WINAPI
|
||||
Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface)
|
||||
{
|
||||
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
|
||||
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
if (!--This->ref)
|
||||
TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
Main_DirectDrawPalette_Destroy(This);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface) {
|
||||
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
|
||||
TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
|
||||
return ++This->ref;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
|
@ -125,10 +125,11 @@ void Main_DirectDrawSurface_ForceDestroy(IDirectDrawSurfaceImpl* This)
|
||||
ULONG WINAPI Main_DirectDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface)
|
||||
{
|
||||
IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(): decreasing from %ld\n", This, This->ref);
|
||||
TRACE("(%p)->(): decreasing from %ld\n", This, ref + 1);
|
||||
|
||||
if (--This->ref == 0)
|
||||
if (ref == 0)
|
||||
{
|
||||
if (This->aux_release)
|
||||
This->aux_release(This->aux_ctx, This->aux_data);
|
||||
@ -139,16 +140,17 @@ ULONG WINAPI Main_DirectDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
ULONG WINAPI Main_DirectDrawSurface_AddRef(LPDIRECTDRAWSURFACE7 iface)
|
||||
{
|
||||
IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(): increasing from %ld\n", This, This->ref);
|
||||
TRACE("(%p)->(): increasing from %ld\n", This, ref - 1);
|
||||
|
||||
return ++This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
@ -164,7 +166,7 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
|
||||
|| IsEqualGUID(&IID_IDirectDrawSurface7, riid)
|
||||
|| IsEqualGUID(&IID_IDirectDrawSurface4, riid))
|
||||
{
|
||||
This->ref++;
|
||||
InterlockedIncrement(&This->ref);
|
||||
*ppObj = ICOM_INTERFACE(This, IDirectDrawSurface7);
|
||||
return S_OK;
|
||||
}
|
||||
@ -172,13 +174,13 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
|
||||
|| IsEqualGUID(&IID_IDirectDrawSurface2, riid)
|
||||
|| IsEqualGUID(&IID_IDirectDrawSurface3, riid))
|
||||
{
|
||||
This->ref++;
|
||||
InterlockedIncrement(&This->ref);
|
||||
*ppObj = ICOM_INTERFACE(This, IDirectDrawSurface3);
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(&IID_IDirectDrawGammaControl, riid))
|
||||
{
|
||||
This->ref++;
|
||||
InterlockedIncrement(&This->ref);
|
||||
*ppObj = ICOM_INTERFACE(This, IDirectDrawGammaControl);
|
||||
return S_OK;
|
||||
}
|
||||
@ -199,7 +201,7 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
|
||||
*ppObj = ICOM_INTERFACE(d3ddevimpl, IDirect3DDevice);
|
||||
TRACE(" returning Direct3DDevice interface at %p.\n", *ppObj);
|
||||
|
||||
This->ref++; /* No idea if this is correct.. Need to check using real Windows */
|
||||
InterlockedIncrement(&This->ref); /* No idea if this is correct.. Need to check using real Windows */
|
||||
return ret_value;
|
||||
}
|
||||
else if (IsEqualGUID( &IID_IDirect3DTexture, riid ) ||
|
||||
@ -230,7 +232,7 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
|
||||
*ppObj = ICOM_INTERFACE(This, IDirect3DTexture2);
|
||||
TRACE(" returning Direct3DTexture2 interface at %p.\n", *ppObj);
|
||||
}
|
||||
This->ref++;
|
||||
InterlockedIncrement(&This->ref);
|
||||
return ret_value;
|
||||
}
|
||||
#endif
|
||||
|
@ -496,10 +496,11 @@ DDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
|
||||
static ULONG WINAPI DDCF_AddRef(LPCLASSFACTORY iface)
|
||||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->() incrementing from %ld.\n", This, This->ref);
|
||||
TRACE("(%p)->() incrementing from %ld.\n", This, ref - 1);
|
||||
|
||||
return InterlockedIncrement(&This->ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI DDCF_Release(LPCLASSFACTORY iface)
|
||||
|
@ -149,13 +149,13 @@ static ISupportErrorInfoVtbl ISupportErrorInfoImpl_VTable;
|
||||
converts a objectpointer to This
|
||||
*/
|
||||
#define _IErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtei)))
|
||||
#define _ICOM_THIS_From_IErrorInfo(class, name) class* This = (class*)(((char*)name)-_IErrorInfo_Offset);
|
||||
#define _ICOM_THIS_From_IErrorInfo(class, name) class* This = (class*)(((char*)name)-_IErrorInfo_Offset)
|
||||
|
||||
#define _ICreateErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtcei)))
|
||||
#define _ICOM_THIS_From_ICreateErrorInfo(class, name) class* This = (class*)(((char*)name)-_ICreateErrorInfo_Offset);
|
||||
#define _ICOM_THIS_From_ICreateErrorInfo(class, name) class* This = (class*)(((char*)name)-_ICreateErrorInfo_Offset)
|
||||
|
||||
#define _ISupportErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtsei)))
|
||||
#define _ICOM_THIS_From_ISupportErrorInfo(class, name) class* This = (class*)(((char*)name)-_ISupportErrorInfo_Offset);
|
||||
#define _ICOM_THIS_From_ISupportErrorInfo(class, name) class* This = (class*)(((char*)name)-_ISupportErrorInfo_Offset)
|
||||
|
||||
/*
|
||||
converts This to a objectpointer
|
||||
@ -227,15 +227,17 @@ static ULONG WINAPI IErrorInfoImpl_Release(
|
||||
IErrorInfo* iface)
|
||||
{
|
||||
_ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
|
||||
TRACE("(%p)->(count=%lu)\n",This,This->ref);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
if (!InterlockedDecrement(&This->ref))
|
||||
TRACE("(%p)->(count=%lu)\n",This,ref+1);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
TRACE("-- destroying IErrorInfo(%p)\n",This);
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IErrorInfoImpl_GetGUID(
|
||||
|
@ -394,10 +394,11 @@ static ULONG WINAPI IMallocSpy_fnAddRef (LPMALLOCSPY iface)
|
||||
{
|
||||
|
||||
_MallocSpy *This = (_MallocSpy *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
|
||||
TRACE ("(%p)->(count=%lu)\n", This, ref - 1);
|
||||
|
||||
return ++(This->ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@ -410,13 +411,14 @@ static ULONG WINAPI IMallocSpy_fnRelease (LPMALLOCSPY iface)
|
||||
{
|
||||
|
||||
_MallocSpy *This = (_MallocSpy *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
|
||||
TRACE ("(%p)->(count=%lu)\n", This, ref + 1);
|
||||
|
||||
if (!--(This->ref)) {
|
||||
if (!ref) {
|
||||
/* our allocation list MUST be empty here */
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IMallocSpy_fnPreAlloc(LPMALLOCSPY iface, ULONG cbRequest)
|
||||
|
@ -181,8 +181,11 @@ static ULONG WINAPI OleAdviseHolderImpl_AddRef(
|
||||
LPOLEADVISEHOLDER iface)
|
||||
{
|
||||
OleAdviseHolderImpl *This = (OleAdviseHolderImpl *)iface;
|
||||
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
|
||||
return ++(This->ref);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(ref=%ld)\n", This, ref - 1);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -96,13 +96,13 @@ static IRecordInfoImpl *IRecordInfoImpl_Construct()
|
||||
static ULONG CALLBACK IRecordInfoImpl_AddRef(IRecordInfo *iface)
|
||||
{
|
||||
IRecordInfoImpl* This=(IRecordInfoImpl*)iface;
|
||||
return ++This->ref;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static ULONG CALLBACK IRecordInfoImpl_Release(IRecordInfo *iface)
|
||||
{
|
||||
IRecordInfoImpl* This=(IRecordInfoImpl*)iface;
|
||||
return --This->ref;
|
||||
return InterlockedDecrement(&This->ref);
|
||||
}
|
||||
|
||||
static BOOL fail_GetSize; /* Whether to fail the GetSize call */
|
||||
|
@ -847,7 +847,7 @@ typedef struct tagITypeLibImpl
|
||||
{
|
||||
ITypeLib2Vtbl *lpVtbl;
|
||||
ITypeCompVtbl *lpVtblTypeComp;
|
||||
UINT ref;
|
||||
ULONG ref;
|
||||
TLIBATTR LibAttr; /* guid,lcid,syskind,version,flags */
|
||||
|
||||
/* strings can be stored in tlb as multibyte strings BUT they are *always*
|
||||
@ -958,7 +958,7 @@ typedef struct tagITypeInfoImpl
|
||||
{
|
||||
ITypeInfo2Vtbl *lpVtbl;
|
||||
ITypeCompVtbl *lpVtblTypeComp;
|
||||
UINT ref;
|
||||
ULONG ref;
|
||||
TYPEATTR TypeAttr ; /* _lots_ of type information. */
|
||||
ITypeLibImpl * pTypeLib; /* back pointer to typelib */
|
||||
int index; /* index in this typelib; */
|
||||
@ -1276,7 +1276,7 @@ static void dump_DispParms(DISPPARAMS * pdp)
|
||||
|
||||
static void dump_TypeInfo(ITypeInfoImpl * pty)
|
||||
{
|
||||
TRACE("%p ref=%u\n", pty, pty->ref);
|
||||
TRACE("%p ref=%lu\n", pty, pty->ref);
|
||||
TRACE("attr:%s\n", debugstr_guid(&(pty->TypeAttr.guid)));
|
||||
TRACE("kind:%s\n", typekind_desc[pty->TypeAttr.typekind]);
|
||||
TRACE("fct:%u var:%u impl:%u\n",
|
||||
@ -3434,10 +3434,11 @@ static HRESULT WINAPI ITypeLib2_fnQueryInterface(
|
||||
static ULONG WINAPI ITypeLib2_fnAddRef( ITypeLib2 *iface)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->ref was %u\n",This, This->ref);
|
||||
TRACE("(%p)->ref was %lu\n",This, ref - 1);
|
||||
|
||||
return ++(This->ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* ITypeLib::Release
|
||||
@ -3445,12 +3446,11 @@ static ULONG WINAPI ITypeLib2_fnAddRef( ITypeLib2 *iface)
|
||||
static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
--(This->ref);
|
||||
TRACE("(%p)->(%lu)\n",This, ref);
|
||||
|
||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
||||
|
||||
if (!This->ref)
|
||||
if (!ref)
|
||||
{
|
||||
/* remove cache entry */
|
||||
TRACE("removing from cache list\n");
|
||||
@ -3493,7 +3493,7 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* ITypeLib::GetTypeInfoCount
|
||||
@ -4110,12 +4110,12 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface(
|
||||
static ULONG WINAPI ITypeInfo_fnAddRef( ITypeInfo2 *iface)
|
||||
{
|
||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
++(This->ref);
|
||||
ITypeLib2_AddRef((ITypeLib2*)This->pTypeLib);
|
||||
|
||||
TRACE("(%p)->ref is %u\n",This, This->ref);
|
||||
return This->ref;
|
||||
TRACE("(%p)->ref is %lu\n",This, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* ITypeInfo::Release
|
||||
@ -4123,12 +4123,11 @@ static ULONG WINAPI ITypeInfo_fnAddRef( ITypeInfo2 *iface)
|
||||
static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
||||
{
|
||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
--(This->ref);
|
||||
TRACE("(%p)->(%lu)\n",This, ref);
|
||||
|
||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
||||
|
||||
if (This->ref) {
|
||||
if (ref) {
|
||||
/* We don't release ITypeLib when ref=0 becouse
|
||||
it means that funtion is called by ITypeLi2_Release */
|
||||
ITypeLib2_Release((ITypeLib2*)This->pTypeLib);
|
||||
@ -4156,7 +4155,7 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* ITypeInfo::GetTypeAttr
|
||||
|
@ -1142,10 +1142,11 @@ static HRESULT WINAPI ICreateTypeInfo2_fnQueryInterface(
|
||||
static ULONG WINAPI ICreateTypeInfo2_fnAddRef(ICreateTypeInfo2 *iface)
|
||||
{
|
||||
ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->ref was %u\n",This, This->ref);
|
||||
TRACE("(%p)->ref was %lu\n",This, ref - 1);
|
||||
|
||||
return ++(This->ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@ -1156,12 +1157,11 @@ static ULONG WINAPI ICreateTypeInfo2_fnAddRef(ICreateTypeInfo2 *iface)
|
||||
static ULONG WINAPI ICreateTypeInfo2_fnRelease(ICreateTypeInfo2 *iface)
|
||||
{
|
||||
ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
--(This->ref);
|
||||
TRACE("(%p)->(%lu)\n",This, ref);
|
||||
|
||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
||||
|
||||
if (!This->ref) {
|
||||
if (!ref) {
|
||||
if (This->typelib) {
|
||||
ICreateTypeLib2_fnRelease((ICreateTypeLib2 *)This->typelib);
|
||||
This->typelib = NULL;
|
||||
@ -1172,7 +1172,7 @@ static ULONG WINAPI ICreateTypeInfo2_fnRelease(ICreateTypeInfo2 *iface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
@ -3009,10 +3009,11 @@ static HRESULT WINAPI ICreateTypeLib2_fnQueryInterface(
|
||||
static ULONG WINAPI ICreateTypeLib2_fnAddRef(ICreateTypeLib2 *iface)
|
||||
{
|
||||
ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->ref was %u\n",This, This->ref);
|
||||
TRACE("(%p)->ref was %lu\n",This, ref - 1);
|
||||
|
||||
return ++(This->ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@ -3023,12 +3024,11 @@ static ULONG WINAPI ICreateTypeLib2_fnAddRef(ICreateTypeLib2 *iface)
|
||||
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
|
||||
{
|
||||
ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
--(This->ref);
|
||||
TRACE("(%p)->(%lu)\n",This, ref);
|
||||
|
||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
||||
|
||||
if (!This->ref) {
|
||||
if (!ref) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MSFT_SEG_MAX; i++) {
|
||||
@ -3050,7 +3050,7 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return This->ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user