Commit d8e89f31 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

msscript.ocx: Uncache the module objects when adding new code.

parent c8e4ceb4
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment