Hi Jacek,
On 12/06/2020 18:14, Jacek Caban wrote:
Hi Gabriel,
On 01.06.2020 16:51, Jacek Caban wrote:
On 01.06.2020 14:21, Gabriel Ivăncescu wrote:
Or maybe script module should just store ScriptHost reference.
It wouldn't change much and we need a ref to the control anyway (to start the script for example).
I would need a deeper look to be sure, but it seems to me that it would solve all your problems by not having to store control reference in modules. Starting script doesn't really need control. It currently needs it only to access script host and check control state. Control state could be reworked to not require it (test_State() on emulated script engine would be interesting for such rework).
I tested it myself and, as suspected, we don't need control object to start the script engine. I send patches for that. I hope it helps.
Jacek
On second thought, it actually might help with the circular refcounting—because the script engine is released in put_Language, so we can just remove the weak refs to the host from the detached modules.
I'm not 100% sure yet, will do more testing. But I hope it works to pass all tests once I rebase it.
Thanks, Gabriel