[PATCH] Remove potential reference count races

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


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

---
 dlls/jscript/engine.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 9123a2b..5606061 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -187,7 +187,7 @@ void release_bytecode(bytecode_t*) DECLSPEC_HIDDEN;
 
 static inline void bytecode_addref(bytecode_t *code)
 {
-    code->ref++;
+    InterlockedIncrement(&code->ref);
 }
 
 HRESULT script_parse(script_ctx_t*,const WCHAR*,const WCHAR*,BOOL,parser_ctx_t**) DECLSPEC_HIDDEN;
@@ -217,7 +217,7 @@ void scope_release(scope_chain_t*) DECLSPEC_HIDDEN;
 
 static inline void scope_addref(scope_chain_t *scope)
 {
-    scope->ref++;
+    InterlockedIncrement(&scope->ref);
 }
 
 typedef struct _except_frame_t except_frame_t;
@@ -244,7 +244,7 @@ struct _exec_ctx_t {
 
 static inline void exec_addref(exec_ctx_t *ctx)
 {
-    ctx->ref++;
+    InterlockedIncrement(&ctx->ref);
 }
 
 void exec_release(exec_ctx_t*) DECLSPEC_HIDDEN;
-- 
1.7.7.6




More information about the wine-patches mailing list