[PATCH 2/2] vbscript: Use the global script dispatch for items with the SCRIPTITEM_GLOBALMEMBERS flag.

Jacek Caban jacek at codeweavers.com
Tue Feb 25 05:58:06 CST 2020


On 24.02.2020 14:44, Gabriel Ivăncescu wrote:
> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
> ---
>   dlls/vbscript/tests/vbscript.c |  3 +++
>   dlls/vbscript/vbscript.c       | 14 ++++++++++++--
>   2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/vbscript/tests/vbscript.c b/dlls/vbscript/tests/vbscript.c
> index 8536ee1..9c62678 100644
> --- a/dlls/vbscript/tests/vbscript.c
> +++ b/dlls/vbscript/tests/vbscript.c
> @@ -1813,6 +1813,9 @@ static void test_named_items(void)
>       ok(hres == E_INVALIDARG, "GetScriptDispatch returned: %08x\n", hres);
>   
>       script_disp = get_script_dispatch(script, NULL);
> +    script_disp2 = get_script_dispatch(script, L"globalItem");
> +    ok(script_disp == script_disp2, "get_script_dispatch returned different dispatch objects.\n");
> +    IDispatchEx_Release(script_disp2);
>       script_disp2 = get_script_dispatch(script, L"codeONLYitem");
>       ok(script_disp != script_disp2, "get_script_dispatch returned same dispatch objects.\n");
>   
> diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
> index 27985bf..c563a09 100644
> --- a/dlls/vbscript/vbscript.c
> +++ b/dlls/vbscript/vbscript.c
> @@ -91,6 +91,16 @@ static inline BOOL is_started(VBScript *This)
>           || This->state == SCRIPTSTATE_DISCONNECTED;
>   }
>   
> +static HRESULT create_named_item_script_obj(script_ctx_t *ctx, named_item_t *item)
> +{
> +    if(item->flags & SCRIPTITEM_GLOBALMEMBERS) {
> +        item->script_obj = ctx->script_obj;
> +        IDispatchEx_AddRef(&item->script_obj->IDispatchEx_iface);
>

ctx->script_obj may not be right anymore at this point, see the attached 
test. It would be probably better to do that in AddNamedItem(). We 
already have SCRIPTITEM_GLOBALMEMBERS special treatment there.


Thanks,

Jacek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.diff
Type: text/x-patch
Size: 1965 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200225/2509c04f/attachment-0001.bin>


More information about the wine-devel mailing list