return hres;
}
-static void run_terminator(vbdisp_t *This)
+static BOOL run_terminator(vbdisp_t *This)
{
+ DISPPARAMS dp = {0};
+
if(This->terminator_ran)
- return;
+ return TRUE;
This->terminator_ran = TRUE;
- if(This->desc->class_terminate_id) {
- DISPPARAMS dp = {0};
-
- This->ref++;
- exec_script(This->desc->ctx, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET],
- (IDispatch*)&This->IDispatchEx_iface, &dp, NULL);
- This->ref--;
- }
+ if(!This->desc->class_terminate_id)
+ return TRUE;
+ This->ref++;
+ exec_script(This->desc->ctx, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET],
+ (IDispatch*)&This->IDispatchEx_iface, &dp, NULL);
+ return !--This->ref;
}
static void clean_props(vbdisp_t *This)
TRACE("(%p) ref=%d\n", This, ref);
- if(!ref)
- run_terminator(This);
- if(!ref) {
+ if(!ref && run_terminator(This)) {
clean_props(This);
list_remove(&This->entry);
heap_free(This);
run_terminator(iter);
LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &ctx->objects, vbdisp_t, entry) {
+ IDispatchEx_AddRef(&iter->IDispatchEx_iface);
clean_props(iter);
iter->desc = NULL;
+ IDispatchEx_Release(&iter->IDispatchEx_iface);
}
}