Jacek Caban : jscript: Keep reference to bytecode in call_frame_t.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 29 08:53:21 CDT 2016


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Mar 28 17:50:18 2016 +0200

jscript: Keep reference to bytecode in call_frame_t.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/engine.c | 3 ++-
 dlls/jscript/engine.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 802e408..b14ec2d 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -2388,6 +2388,7 @@ static void release_call_frame(call_frame_t *frame)
     if(frame->scope)
         scope_release(frame->scope);
     jsval_release(frame->ret);
+    release_bytecode(frame->bytecode);
     heap_free(frame);
 }
 
@@ -2579,7 +2580,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
     if(!frame)
         return E_OUTOFMEMORY;
 
-    frame->bytecode = bytecode;
+    frame->bytecode = bytecode_addref(bytecode);
     frame->function = function;
     frame->ip = function->instr_off;
     frame->stack_base = ctx->stack_top;
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 4915b60..4b3bba2 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -168,9 +168,10 @@ typedef struct _bytecode_t {
 HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,const WCHAR*,BOOL,BOOL,bytecode_t**) DECLSPEC_HIDDEN;
 void release_bytecode(bytecode_t*) DECLSPEC_HIDDEN;
 
-static inline void bytecode_addref(bytecode_t *code)
+static inline bytecode_t *bytecode_addref(bytecode_t *code)
 {
     code->ref++;
+    return code;
 }
 
 typedef struct _scope_chain_t {




More information about the wine-cvs mailing list