[PATCH v2 7/8] vbscript: Destroy the entire script context when the script engine is closed.

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Oct 30 09:39:38 CDT 2019


On 10/30/19 4:25 PM, Jacek Caban wrote:
> On 10/30/19 1:57 PM, Gabriel Ivăncescu wrote:
>> When the engine is closed, even the persistent code is removed.
>>
>> Signed-off-by: Gabriel Ivăncescu<gabrielopcode at gmail.com>
>> ---
>>
>> Removing the context altogether is necessary for the future when it will
>> be ref counted (patch that will come after these).
> 
> 
> Why will it be necessary? I'm not sure that initializing the context in 
> SetInterfaceSafetyOptions implementation is an improvement. Can we just 
> remove persistent code from the context when script engine is closed 
> instead? Are safety options really lost on script close?
> 
> 
> Jacek
> 

We can't remove only the persistent code because of the reason I 
mentioned in the comments :-)

When we will ref count the script context (in the next patch series), 
we'll need access to the script context from another place (i.e. the 
TypeInfo).

The script will, of course, have to initialize another context. Re-using 
the same context will clash with the one the TypeInfo is still holding. 
That's not going to work.

The only reason I initialize the context is because it is needed to be 
allocated there. This patch sets it to NULL when it destroys it, so 
those places would cause a page fault otherwise.

Of course, I *could* be creating a new context as soon as it is 
destroyed, but that can potentially fail. I'm not sure that *closing* a 
script having chance to fail is a good idea.

So instead it just sets it to NULL and then it gets initialized on demand.

The other places have the thread_id check, so they cannot be without a 
context, hence I didn't add init_ctx call there.



More information about the wine-devel mailing list