[PATCH v4 02/11] msscript.ocx: Don't release the script engine when the control is released.
Jacek Caban
jacek at codeweavers.com
Wed Jun 17 14:20:57 CDT 2020
On 15.06.2020 15:00, Gabriel Ivăncescu wrote:
> 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.
While I agree that we need to change how release_script_engine() works
for modules, this doesn't seem right. There is likely a circular
dependency between script engine and script host because script host
implements IActiveScriptSite. This is fine, because script control
guarantees that it will close script engine at some point, breaking the
cycle. With your patch, you depend on ref count to close the engine, so
in practice it will leak. See the attached hack for a quick test. It
passes on Windows and unpatched Wine.
I think that it may be a good idea to just store number of modules alive
in script host (maybe even move it from control). You'd then change
release_script_engine to something like:
void detach_script_module(ScriptHost *host)
{
if(--host->module_count) return;
// code closing the engine
}
Thanks,
Jacek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: leak.diff
Type: text/x-patch
Size: 463 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200617/9c579df6/attachment.bin>
More information about the wine-devel
mailing list