Commit 79ecb0d7 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

- Use only stored result of Interlocked* in AddRef/Release.

- Expand TRACEs to display the ref count.
parent 11db0ea6
......@@ -78,25 +78,25 @@ static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* if
static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManager* iface)
{
SecManagerImpl *This = (SecManagerImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)\n",This);
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
return InterlockedIncrement(&This->ref);
return refCount;
}
static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
{
SecManagerImpl *This = (SecManagerImpl *)iface;
ULONG ref;
TRACE("(%p)\n",This);
ULONG refCount = InterlockedDecrement(&This->ref);
ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
/* destroy the object if there's no more reference on it */
if (ref==0){
if (!refCount){
HeapFree(GetProcessHeap(),0,This);
}
return ref;
return refCount;
}
static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManager *iface,
......@@ -238,10 +238,11 @@ static HRESULT WINAPI ZoneMgrImpl_QueryInterface(IInternetZoneManager* iface, RE
static ULONG WINAPI ZoneMgrImpl_AddRef(IInternetZoneManager* iface)
{
ZoneMgrImpl* This = (ZoneMgrImpl*)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p) was %lu\n", This, This->ref);
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
return InterlockedIncrement(&This->ref);
return refCount;
}
/********************************************************************
......@@ -250,15 +251,13 @@ static ULONG WINAPI ZoneMgrImpl_AddRef(IInternetZoneManager* iface)
static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManager* iface)
{
ZoneMgrImpl* This = (ZoneMgrImpl*)iface;
ULONG ref;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p) was %lu\n", This, This->ref);
ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
if(!ref)
if(!refCount)
HeapFree(GetProcessHeap(), 0, This);
return ref;
return refCount;
}
/********************************************************************
......
......@@ -103,10 +103,11 @@ static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,
static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)\n",This);
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
return InterlockedIncrement(&This->ref);
return refCount;
}
/******************************************************************************
......@@ -115,19 +116,17 @@ static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
ULONG ref;
TRACE("(%p)\n",This);
ULONG refCount = InterlockedDecrement(&This->ref);
ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
/* destroy the object if there's no more reference on it */
if (ref == 0) {
if (!refCount) {
HeapFree(GetProcessHeap(),0,This->URLName);
HeapFree(GetProcessHeap(),0,This);
}
return ref;
return refCount;
}
/******************************************************************************
......
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