Module: wine Branch: master Commit: b4e89eec1729d325bd6ff0708fdba63dbd99ac84 URL: https://source.winehq.org/git/wine.git/?a=commit;h=b4e89eec1729d325bd6ff0708...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Feb 28 17:26:21 2020 +0100
vbscript: Lookup host global object in interp_me instead of storing it in script context.
Inspired by patch by Gabriel Ivăncescu.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/vbscript/interp.c | 19 +++++++++++++------ dlls/vbscript/vbscript.c | 10 ---------- dlls/vbscript/vbscript.h | 2 -- 3 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 27a4aee9bd..d2e1d2a63f 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -1524,16 +1524,23 @@ static HRESULT interp_me(exec_ctx_t *ctx)
TRACE("\n");
- if(ctx->vbthis) + if(ctx->vbthis) { disp = (IDispatch*)&ctx->vbthis->IDispatchEx_iface; - else if(ctx->code->named_item) + }else if(ctx->code->named_item) { disp = (ctx->code->named_item->flags & SCRIPTITEM_CODEONLY) ? (IDispatch*)&ctx->code->named_item->script_obj->IDispatchEx_iface : ctx->code->named_item->disp; - else if(ctx->script->host_global) - disp = ctx->script->host_global; - else - disp = (IDispatch*)&ctx->script->script_obj->IDispatchEx_iface; + }else { + named_item_t *item; + disp = NULL; + LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) { + if(!(item->flags & SCRIPTITEM_GLOBALMEMBERS)) continue; + disp = item->disp; + break; + } + if(!disp) + disp = (IDispatch*)&ctx->script->script_obj->IDispatchEx_iface; + }
IDispatch_AddRef(disp); V_VT(&v) = VT_DISPATCH; diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index 27985bfc53..ea80911f10 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -283,11 +283,6 @@ static void release_script(script_ctx_t *ctx) release_named_item(iter); }
- if(ctx->host_global) { - IDispatch_Release(ctx->host_global); - ctx->host_global = NULL; - } - if(ctx->secmgr) { IInternetHostSecurityManager_Release(ctx->secmgr); ctx->secmgr = NULL; @@ -675,11 +670,6 @@ static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstr WARN("object does not implement IDispatch\n"); return hres; } - - if(This->ctx->host_global) - IDispatch_Release(This->ctx->host_global); - IDispatch_AddRef(disp); - This->ctx->host_global = disp; }
item = heap_alloc(sizeof(*item)); diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 5860863a0c..27ddae3979 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -186,8 +186,6 @@ struct _script_ctx_t { IInternetHostSecurityManager *secmgr; DWORD safeopt;
- IDispatch *host_global; - ScriptDisp *script_obj;
BuiltinDisp *global_obj;