jscript: Addd jsdisp_addref helper function.

This commit is contained in:
Jacek Caban 2010-09-07 15:42:34 +02:00 committed by Alexandre Julliard
parent ac8d2f1fae
commit f46f926134
6 changed files with 14 additions and 9 deletions

View file

@ -506,8 +506,8 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISP
}
if(retv) {
jsdisp_addref(jsthis);
var_set_jsdisp(retv, jsthis);
IDispatch_AddRef(V_DISPATCH(retv));
}
return S_OK;
@ -745,8 +745,8 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR
if(cmp_func)
jsdisp_release(cmp_func);
if(retv) {
jsdisp_addref(jsthis);
var_set_jsdisp(retv, jsthis);
IDispatch_AddRef(V_DISPATCH(retv));
}
return S_OK;
}
@ -850,8 +850,8 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR
return hres;
if(retv) {
jsdisp_addref(jsthis);
var_set_jsdisp(retv, jsthis);
IDispatch_AddRef(V_DISPATCH(retv));
}
return S_OK;

View file

@ -437,7 +437,7 @@ static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid,
*ppv = _IDispatchEx_(This);
}else if(IsEqualGUID(&IID_IDispatchJS, riid)) {
TRACE("(%p)->(IID_IDispatchJS %p)\n", This, ppv);
IUnknown_AddRef(_IDispatchEx_(This));
jsdisp_addref(This);
*ppv = This;
return S_OK;
}else {
@ -755,7 +755,7 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b
dispex->prototype = prototype;
if(prototype)
IDispatchEx_AddRef(_IDispatchEx_(prototype));
jsdisp_addref(prototype);
dispex->prop_cnt = 1;
dispex->props[0].name = NULL;

View file

@ -143,7 +143,7 @@ HRESULT scope_push(scope_chain_t *scope, jsdisp_t *obj, scope_chain_t **ret)
new_scope->ref = 1;
IDispatchEx_AddRef(_IDispatchEx_(obj));
jsdisp_addref(obj);
new_scope->obj = obj;
if(scope) {
@ -197,7 +197,7 @@ HRESULT create_exec_ctx(script_ctx_t *script_ctx, IDispatch *this_obj, jsdisp_t
ctx->this_obj = to_disp(script_ctx->global);
IDispatch_AddRef(ctx->this_obj);
IDispatchEx_AddRef(_IDispatchEx_(var_disp));
jsdisp_addref(var_disp);
ctx->var_disp = var_disp;
if(scope) {

View file

@ -547,7 +547,7 @@ static HRESULT Function_arguments(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
switch(flags) {
case DISPATCH_PROPERTYGET: {
if(function->arguments) {
IDispatchEx_AddRef(_IDispatchEx_(function->arguments));
jsdisp_addref(function->arguments);
var_set_jsdisp(retv, function->arguments);
}else {
V_VT(retv) = VT_NULL;

View file

@ -112,8 +112,8 @@ static HRESULT constructor_call(jsdisp_t *constr, WORD flags, DISPPARAMS *dp,
if(flags != DISPATCH_PROPERTYGET)
return jsdisp_call_value(constr, flags, dp, retv, ei, sp);
jsdisp_addref(constr);
var_set_jsdisp(retv, constr);
IDispatchEx_AddRef(_IDispatchEx_(constr));
return S_OK;
}

View file

@ -192,6 +192,11 @@ static inline IDispatch *to_disp(jsdisp_t *jsdisp)
return (IDispatch*)&jsdisp->lpIDispatchExVtbl;
}
static inline void jsdisp_addref(jsdisp_t *jsdisp)
{
IDispatchEx_AddRef(_IDispatchEx_(jsdisp));
}
static inline void jsdisp_release(jsdisp_t *jsdisp)
{
IDispatchEx_Release(_IDispatchEx_(jsdisp));