Commit b4e89eec authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3d23f095
......@@ -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;
......
......@@ -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));
......
......@@ -186,8 +186,6 @@ struct _script_ctx_t {
IInternetHostSecurityManager *secmgr;
DWORD safeopt;
IDispatch *host_global;
ScriptDisp *script_obj;
BuiltinDisp *global_obj;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment