vbscript: Factor out detach_global_objects.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ace3279a26
commit
43dbf3a60e
|
@ -2592,6 +2592,27 @@ static const builtin_prop_t err_props[] = {
|
|||
{DISPID_ERR_RAISE, Err_Raise, 0, 1, 5},
|
||||
};
|
||||
|
||||
void detach_global_objects(script_ctx_t *ctx)
|
||||
{
|
||||
if(ctx->err_obj) {
|
||||
IDispatchEx_Release(&ctx->err_obj->IDispatchEx_iface);
|
||||
ctx->err_obj = NULL;
|
||||
}
|
||||
|
||||
if(ctx->global_obj) {
|
||||
IDispatchEx_Release(&ctx->global_obj->IDispatchEx_iface);
|
||||
ctx->global_obj = NULL;
|
||||
}
|
||||
|
||||
if(ctx->script_obj) {
|
||||
ScriptDisp *script_obj = ctx->script_obj;
|
||||
|
||||
ctx->script_obj = NULL;
|
||||
script_obj->ctx = NULL;
|
||||
IDispatchEx_Release(&script_obj->IDispatchEx_iface);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT init_global(script_ctx_t *ctx)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
|
|
@ -189,24 +189,7 @@ static void release_script(script_ctx_t *ctx)
|
|||
ctx->site = NULL;
|
||||
}
|
||||
|
||||
if(ctx->err_obj) {
|
||||
IDispatchEx_Release(&ctx->err_obj->IDispatchEx_iface);
|
||||
ctx->err_obj = NULL;
|
||||
}
|
||||
|
||||
if(ctx->global_obj) {
|
||||
IDispatchEx_Release(&ctx->global_obj->IDispatchEx_iface);
|
||||
ctx->global_obj = NULL;
|
||||
}
|
||||
|
||||
if(ctx->script_obj) {
|
||||
ScriptDisp *script_obj = ctx->script_obj;
|
||||
|
||||
ctx->script_obj = NULL;
|
||||
script_obj->ctx = NULL;
|
||||
IDispatchEx_Release(&script_obj->IDispatchEx_iface);
|
||||
}
|
||||
|
||||
detach_global_objects(ctx);
|
||||
heap_pool_free(&ctx->heap);
|
||||
heap_pool_init(&ctx->heap);
|
||||
}
|
||||
|
|
|
@ -363,6 +363,7 @@ void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
|
|||
IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
|
||||
void clear_ei(EXCEPINFO*) DECLSPEC_HIDDEN;
|
||||
HRESULT report_script_error(script_ctx_t*) DECLSPEC_HIDDEN;
|
||||
void detach_global_objects(script_ctx_t*) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef struct {
|
||||
UINT16 len;
|
||||
|
|
Loading…
Reference in New Issue