From: "Gabriel Ivăncescu" Subject: Re: [PATCH v7 9/9] msscript.ocx: Implement the ScriptModule enumerator. Message-Id: <8f34de29-6629-45c1-10f0-57afc15bb2d7@gmail.com> Date: Tue, 30 Jun 2020 14:51:31 +0300 In-Reply-To: References: 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