I thought I had found a fix that would resolve the issue for the older bug report, and the current one, but it turns out that the fix still results in a memory leak.

After googling for "querySelectorAll", which is the cause of the crash in the older bug report, I came across a similar bug report in PowerShell and several posts on Stack Overflow, where using this call was resulting a crash.

As far as I can tell, there is something specific to "querySelectorAll" that is causing applications to crash when it is called in a specific context, and there does not seem to be a way to prevent this.

Because of this, I am going to revert the fix for the older bug report, which will reinstate the correct memory handling behaviour for all other $comval() calls, but this does mean that using "querySelectorAll" in the way it is used in the older script will still result in a crash.

This change will be in the next beta.