[DEVENUM] Use Interlocked* functions in AddRef and Release

Paul Vriens Paul.Vriens at xs4all.nl
Sun Jan 9 13:43:07 CST 2005


Hi,

A very short one this time. Christian did the rest.

Changelog:
- use Interlocked* functions in AddRef and Release.
- store the result of the Interlocked functions and use only this.

Cheers,

Paul Vriens

Index: dlls/devenum/mediacatenum.c
===================================================================
RCS file: /home/wine/wine/dlls/devenum/mediacatenum.c,v
retrieving revision 1.13
diff -u -r1.13 mediacatenum.c
--- dlls/devenum/mediacatenum.c 9 Jan 2005 18:24:41 -0000       1.13
+++ dlls/devenum/mediacatenum.c 9 Jan 2005 19:34:59 -0000
@@ -84,16 +84,18 @@
 static ULONG WINAPI DEVENUM_IPropertyBag_Release(LPPROPERTYBAG iface)
 {
     RegPropBagImpl *This = (RegPropBagImpl *)iface;
+    ULONG ref;
  
     TRACE("\n");
  
-    if (InterlockedDecrement(&This->ref) == 0) {
+    ref = InterlockedDecrement(&This->ref);
+    if (ref == 0) {
         RegCloseKey(This->hkey);
         CoTaskMemFree(This);
         DEVENUM_UnlockModule();
         return 0;
     }
-    return This->ref;
+    return ref;
 }
  
 static HRESULT WINAPI DEVENUM_IPropertyBag_Read(





More information about the wine-patches mailing list