[PATCH 03/13] msscript.ocx: Add initial IScriptModule stub implementation.

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Apr 14 07:31:36 CDT 2020


On 09/04/2020 23:27, Nikolay Sivov wrote:
> On 4/9/20 5:34 PM, Gabriel Ivăncescu wrote:
>> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
>> ---
>>
>> We have to treat a ref count of 0 in a special manner when they are 
>> linked
>> to the script control, because the modules must exist even when they have
>> no external refs (as the script control can still use them).
>>
>> However, as evidenced by the tests, they must *not* keep a ref to the 
>> script
>> control in this case, as it would create a circular ref and make no 
>> sense,
>> anyway.
> An alternative to that is to separate actual data of such script_module, 
> using separate refcount, and IScriptModule accessor object.
> 

Sorry, I completely missed this reply earlier for some reason...

But, wouldn't this alternative require that we duplicate the module's 
data? Let's look at the module's name: it's required both by the Module 
Collection (to retrieve a module, or add one without conflict) and by an 
individual Module interface (since it can be orphaned, see put_Language 
which releases the modules from the Script Control).

Obviously, it's possible that no module is held externally and we only 
query for module names using the Module Collection. In this case, the 
module must *not* hold a ref to the Script Control, hence the hold trick.

However, if a module is retrieved, then the module data would have to be 
duplicated/allocated in a different spot, and refcount to the Script 
Control added, since it's now externally held with a refcount of 1.

It's, IMO, way more complicated than the current approach.

Thanks,
Gabriel



More information about the wine-devel mailing list