Hi Jacek,
On 29/06/2020 19:01, Jacek Caban wrote:
Hi Gabriel,
On 25.06.2020 16:59, Gabriel Ivăncescu wrote:
+struct module_enum { + IEnumVARIANT IEnumVARIANT_iface; + LONG ref;
+ UINT pos; + ScriptHost *host; + ScriptControl *control; +};
Do you need host reference if you already have control reference?
Thanks,
Jacek
Unfortunately yeah, because the enumerator becomes invalid when the host is detached. However, it still keeps the script control alive, and I have tests for both (the script control test is at the end of the test).
Please see the comment in the test `The enumerator is also invalid' for this behavior.
The way I do it right now is I compare the original host held by the enumerator to the control's host—if they don't match, it was detached.
I know it's not pretty, but I couldn't find a better way. If you have a better idea please let me know.
Thanks, Gabriel