Commit dffd3e50 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

rpcrt4: Tidy up CStdStubBuffer_AddRef,Release.

parent 7a120c99
...@@ -105,23 +105,26 @@ ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface) ...@@ -105,23 +105,26 @@ ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
{ {
CStdStubBuffer *This = (CStdStubBuffer *)iface; CStdStubBuffer *This = (CStdStubBuffer *)iface;
TRACE("(%p)->AddRef()\n",This); TRACE("(%p)->AddRef()\n",This);
return ++(This->RefCount); return InterlockedIncrement(&This->RefCount);
} }
ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface, ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface,
LPPSFACTORYBUFFER pPSF) LPPSFACTORYBUFFER pPSF)
{ {
CStdStubBuffer *This = (CStdStubBuffer *)iface; CStdStubBuffer *This = (CStdStubBuffer *)iface;
ULONG refs;
TRACE("(%p)->Release()\n",This); TRACE("(%p)->Release()\n",This);
if (!--(This->RefCount)) { refs = InterlockedDecrement(&This->RefCount);
if (!refs)
{
IRpcStubBuffer_Disconnect(iface); IRpcStubBuffer_Disconnect(iface);
if(This->pPSFactory) if(This->pPSFactory)
IPSFactoryBuffer_Release(This->pPSFactory); IPSFactoryBuffer_Release(This->pPSFactory);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0;
} }
return This->RefCount; return refs;
} }
ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface, ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface,
......
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