Commit 36482273 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

Use InterlockedDecrement and InterlockedIncrement instead of ++/--.

parent a1ccb921
......@@ -529,9 +529,7 @@ ULONG WINAPI OLEFontImpl_AddRef(
{
OLEFontImpl *this = (OLEFontImpl *)iface;
TRACE("(%p)->(ref=%ld)\n", this, this->ref);
this->ref++;
return this->ref;
return InterlockedIncrement(&this->ref);
}
/************************************************************************
......@@ -543,24 +541,20 @@ ULONG WINAPI OLEFontImpl_Release(
IFont* iface)
{
OLEFontImpl *this = (OLEFontImpl *)iface;
ULONG ret;
TRACE("(%p)->(ref=%ld)\n", this, this->ref);
/*
* Decrease the reference count on this object.
*/
this->ref--;
ret = InterlockedDecrement(&this->ref);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (this->ref==0)
{
OLEFontImpl_Destroy(this);
return 0;
}
if (ret==0) OLEFontImpl_Destroy(this);
return this->ref;
return ret;
}
/************************************************************************
......@@ -2087,13 +2081,13 @@ SFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
static ULONG WINAPI
SFCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI SFCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return --(This->ref);
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI SFCF_CreateInstance(
......
......@@ -402,9 +402,7 @@ static ULONG WINAPI OLEPictureImpl_AddRef(
{
OLEPictureImpl *This = (OLEPictureImpl *)iface;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
This->ref++;
return This->ref;
return InterlockedIncrement(&This->ref);
}
/************************************************************************
......@@ -416,24 +414,20 @@ static ULONG WINAPI OLEPictureImpl_Release(
IPicture* iface)
{
OLEPictureImpl *This = (OLEPictureImpl *)iface;
ULONG ret;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
/*
* Decrease the reference count on this object.
*/
This->ref--;
ret = InterlockedDecrement(&This->ref);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (This->ref==0)
{
OLEPictureImpl_Destroy(This);
return 0;
}
if (ret==0) OLEPictureImpl_Destroy(This);
return This->ref;
return ret;
}
......@@ -1691,13 +1685,13 @@ SPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
static ULONG WINAPI
SPCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI SPCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return --(This->ref);
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI SPCF_CreateInstance(
......
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