Sebastian Lackner : browseui: Always use interlocked functions when accessing variable BROWSEUI_refCount.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 2 08:51:51 CST 2015


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

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Sun Mar  1 03:46:06 2015 +0100

browseui: Always use interlocked functions when accessing variable BROWSEUI_refCount.

---

 dlls/browseui/browseui_main.c      | 4 ++--
 dlls/browseui/compcatcachedaemon.c | 4 ++--
 dlls/browseui/progressdlg.c        | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/browseui/browseui_main.c b/dlls/browseui/browseui_main.c
index 78ce326..f509ee5 100644
--- a/dlls/browseui/browseui_main.c
+++ b/dlls/browseui/browseui_main.c
@@ -74,7 +74,7 @@ static void ClassFactory_Destructor(ClassFactory *This)
 {
     TRACE("Destroying class factory %p\n", This);
     heap_free(This);
-    BROWSEUI_refCount--;
+    InterlockedDecrement(&BROWSEUI_refCount);
 }
 
 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
@@ -154,7 +154,7 @@ static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
     This->ctor = ctor;
     *ppvOut = This;
     TRACE("Created class factory %p\n", This);
-    BROWSEUI_refCount++;
+    InterlockedIncrement(&BROWSEUI_refCount);
     return S_OK;
 }
 
diff --git a/dlls/browseui/compcatcachedaemon.c b/dlls/browseui/compcatcachedaemon.c
index 0acb4ec..a5addd2 100644
--- a/dlls/browseui/compcatcachedaemon.c
+++ b/dlls/browseui/compcatcachedaemon.c
@@ -60,7 +60,7 @@ static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This)
     This->cs.DebugInfo->Spare[0] = 0;
     DeleteCriticalSection(&This->cs);
     heap_free(This);
-    BROWSEUI_refCount--;
+    InterlockedDecrement(&BROWSEUI_refCount);
 }
 
 static HRESULT WINAPI CompCatCacheDaemon_QueryInterface(IRunnableTask *iface, REFIID iid, LPVOID *ppvOut)
@@ -159,6 +159,6 @@ HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
 
     TRACE("returning %p\n", This);
     *ppOut = (IUnknown *)This;
-    BROWSEUI_refCount++;
+    InterlockedIncrement(&BROWSEUI_refCount);
     return S_OK;
 }
diff --git a/dlls/browseui/progressdlg.c b/dlls/browseui/progressdlg.c
index 598197b..e61a4cc 100644
--- a/dlls/browseui/progressdlg.c
+++ b/dlls/browseui/progressdlg.c
@@ -268,7 +268,7 @@ static void ProgressDialog_Destructor(ProgressDialog *This)
     This->cs.DebugInfo->Spare[0] = 0;
     DeleteCriticalSection(&This->cs);
     heap_free(This);
-    BROWSEUI_refCount--;
+    InterlockedDecrement(&BROWSEUI_refCount);
 }
 
 static HRESULT WINAPI ProgressDialog_QueryInterface(IProgressDialog *iface, REFIID iid, LPVOID *ppvOut)
@@ -574,6 +574,6 @@ HRESULT ProgressDialog_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
 
     TRACE("returning %p\n", This);
     *ppOut = (IUnknown *)This;
-    BROWSEUI_refCount++;
+    InterlockedIncrement(&BROWSEUI_refCount);
     return S_OK;
 }




More information about the wine-cvs mailing list