Huw Davies : rpcrt4: Tidy up CStdStubBuffer_AddRef,Release.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Sep 7 03:45:51 CDT 2006


Module: wine
Branch: master
Commit: dffd3e5034079febfb07855caa693ac03f316e27
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=dffd3e5034079febfb07855caa693ac03f316e27

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Aug 30 15:16:29 2006 +0100

rpcrt4: Tidy up CStdStubBuffer_AddRef,Release.

---

 dlls/rpcrt4/cstub.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/rpcrt4/cstub.c b/dlls/rpcrt4/cstub.c
index 259956a..38a8a29 100644
--- a/dlls/rpcrt4/cstub.c
+++ b/dlls/rpcrt4/cstub.c
@@ -105,23 +105,26 @@ ULONG WINAPI CStdStubBuffer_AddRef(LPRPC
 {
   CStdStubBuffer *This = (CStdStubBuffer *)iface;
   TRACE("(%p)->AddRef()\n",This);
-  return ++(This->RefCount);
+  return InterlockedIncrement(&This->RefCount);
 }
 
 ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface,
                                       LPPSFACTORYBUFFER pPSF)
 {
   CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  ULONG refs;
+
   TRACE("(%p)->Release()\n",This);
 
-  if (!--(This->RefCount)) {
+  refs = InterlockedDecrement(&This->RefCount);
+  if (!refs)
+  {
     IRpcStubBuffer_Disconnect(iface);
     if(This->pPSFactory)
         IPSFactoryBuffer_Release(This->pPSFactory);
     HeapFree(GetProcessHeap(),0,This);
-    return 0;
   }
-  return This->RefCount;
+  return refs;
 }
 
 ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface,




More information about the wine-cvs mailing list