Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/msscript.ocx/msscript.c | 23 +++++++++++++++++++---- dlls/msscript.ocx/tests/msscript.c | 10 +++++----- 2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c index 4c737e2..60b641f 100644 --- a/dlls/msscript.ocx/msscript.c +++ b/dlls/msscript.ocx/msscript.c @@ -277,6 +277,22 @@ static HRESULT get_script_typeinfo(ScriptModule *module, ITypeInfo **typeinfo) return S_OK; }
+static void uncache_module_objects(ScriptModule *module) +{ + if (module->script_dispatch) + { + IDispatch_Release(module->script_dispatch); + module->script_dispatch = NULL; + } + if (module->script_typeinfo) + { + ITypeInfo_Release(module->script_typeinfo); + module->script_typeinfo = NULL; + } + if (module->procedures) + module->procedures->count = -1; +} + static HRESULT set_script_state(ScriptHost *host, SCRIPTSTATE state) { HRESULT hr; @@ -339,6 +355,8 @@ static HRESULT parse_script_text(ScriptModule *module, BSTR script_text, DWORD f hr = start_script(module->host); if (FAILED(hr)) return hr;
+ uncache_module_objects(module); + hr = IActiveScriptParse_ParseScriptText(module->host->parse, script_text, module->name, NULL, NULL, 0, 1, flag, res, &excepinfo); /* FIXME: more error handling */ @@ -949,10 +967,7 @@ static ULONG WINAPI ScriptModule_Release(IScriptModule *iface) { detach_module(This); SysFreeString(This->name); - if (This->script_dispatch) - IDispatch_Release(This->script_dispatch); - if (This->script_typeinfo) - ITypeInfo_Release(This->script_typeinfo); + uncache_module_objects(This); heap_free(This); }
diff --git a/dlls/msscript.ocx/tests/msscript.c b/dlls/msscript.ocx/tests/msscript.c index 9d2e78d..dbdb00e 100644 --- a/dlls/msscript.ocx/tests/msscript.c +++ b/dlls/msscript.ocx/tests/msscript.c @@ -3341,7 +3341,7 @@ static void test_IScriptControl_get_Procedures(void)
hr = IScriptProcedureCollection_get_Count(procs, &count); ok(hr == S_OK, "IScriptProcedureCollection_get_Count failed: 0x%08x.\n", hr); - todo_wine ok(count == 3, "count is not 3, got %d.\n", count); + ok(count == 3, "count is not 3, got %d.\n", count);
V_VT(&var) = VT_I4; V_I4(&var) = 1; @@ -3454,10 +3454,10 @@ static void test_IScriptControl_get_Procedures(void) hr = IScriptProcedureCollection_get_Count(procs, &count); ok(hr == S_OK, "IScriptProcedureCollection_get_Count failed: 0x%08x.\n", hr); ok(count == ARRAY_SIZE(custom_engine_funcs), "count is not %u, got %d.\n", TypeInfo_GetTypeAttr_cFuncs, count); - todo_wine CHECK_CALLED(GetScriptDispatch); - todo_wine CHECK_CALLED(GetTypeInfo); - todo_wine CHECK_CALLED(GetTypeAttr); - todo_wine CHECK_CALLED(ReleaseTypeAttr); + CHECK_CALLED(GetScriptDispatch); + CHECK_CALLED(GetTypeInfo); + CHECK_CALLED(GetTypeAttr); + CHECK_CALLED(ReleaseTypeAttr);
/* Try without ITypeComp interface */ SET_EXPECT(QI_ITypeComp);