[PATCH] Remove potential reference count races

max at mtew.isa-geek.net max at mtew.isa-geek.net
Sat Oct 27 20:59:23 CDT 2012


From: Max TenEyck Woodbury <max at mtew.isa-geek.net>

---
 dlls/jscript/jsstr.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/jsstr.h b/dlls/jscript/jsstr.h
index ca3b5d9..33ddd1a 100644
--- a/dlls/jscript/jsstr.h
+++ b/dlls/jscript/jsstr.h
@@ -43,13 +43,13 @@ static inline jsstr_t *jsstr_alloc(const WCHAR *str)
 
 static inline void jsstr_release(jsstr_t *str)
 {
-    if(!--str->ref)
+    if(!InterlockedDecrement(&str->ref))
         heap_free(str);
 }
 
 static inline jsstr_t *jsstr_addref(jsstr_t *str)
 {
-    str->ref++;
+    InterlockedIncrement(&str->ref);
     return str;
 }
 
-- 
1.7.7.6




More information about the wine-patches mailing list