Modules must keep refs to the script engine, because the script is closed only when the last non-detached module is released, even if the control is not held anymore. put_Language, however, still releases the engine.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/msscript.ocx/msscript.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c index 8fb127e..fdf7e7d 100644 --- a/dlls/msscript.ocx/msscript.c +++ b/dlls/msscript.ocx/msscript.c @@ -369,8 +369,6 @@ static void release_script_engine(ScriptHost *host) host->script_dispatch = NULL; host->parse = NULL; host->script = NULL; - - IActiveScriptSite_Release(&host->IActiveScriptSite_iface); }
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface) @@ -381,6 +379,7 @@ static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface) TRACE("(%p) ref=%d\n", This, ref);
if(!ref) { + release_script_engine(This); clear_named_items(This); heap_free(This); } @@ -990,7 +989,7 @@ static HRESULT init_script_host(const CLSID *clsid, ScriptHost **ret) return S_OK;
failed: - release_script_engine(host); + IActiveScriptSite_Release(&host->IActiveScriptSite_iface); return hr; }
@@ -1068,7 +1067,7 @@ static ULONG WINAPI ScriptControl_Release(IScriptControl *iface) if (This->site) IOleClientSite_Release(This->site); if (This->host) - release_script_engine(This->host); + IActiveScriptSite_Release(&This->host->IActiveScriptSite_iface); release_modules(This); heap_free(This); } @@ -1179,6 +1178,7 @@ static HRESULT WINAPI ScriptControl_put_Language(IScriptControl *iface, BSTR lan
if (This->host) { release_script_engine(This->host); + IActiveScriptSite_Release(&This->host->IActiveScriptSite_iface); This->host = NULL; }