Hi Gabriel,
On 05.02.2020 18:38, Gabriel Ivăncescu wrote:
Sorry for the noise, but another idea just dawned on me.
What if we ref count the named_item_t itself, and store it from vbscode_t instead. Then, we set the item->script_obj to NULL when it has to be recreated (for persistent code). This shouldn't affect external users that hold ScriptDisp, since it's only referenced from vbscode_t.
Of course we still unlink the named item from the list when script is uninitialized, since that's what tests show.
This approach should, I think, fix all corner cases, even with multiple script dispatches referring to same named item.
Thoughts?
Shouldn't we just ignore SCRIPTTEXT_ISPERSISTENT flag when it's executed in context of named item? Your tests seem to indicate that such code does not survive releasing script. Is there any way they could affect a reinitialized script engine?
Thanks,
Jacek