A quite specific bug

Recommended Posts

Hi again
So continuing down the road that is circular references, I've now stumbled upon what I suspect is a awfully specific bug.

// Dummy class.
class B {}

class A
{
any a;
grid<B> t(10, 10); // Using a dummy class here, because apparently using primitives doesn't crash the application.
A()
{
a.store(@this);
}
}

// Global array of A-handles
array<A@> arr;

void main()
{
arr.insertLast(@A());
}



(This time I haven't modified the add-on files, I promise !)

This code will cause a crash when I try to release the script engine.
If you're curious what the specific crash I get is; it's at line 708 in CScriptGrid::EnumReferences (because buffer = 0).

Adding a if(buffer == 0) return; at the begining fixes it, but that seems more like a hack to me

Share on other sites

Thanks for recreating the problem with a small test. It really makes it a lot easier to investigate this way.

I'll let you know when I have an update.

Share on other sites

I've fixed this in revision 1966.

The solution that you proposed is the correct one. The buffer becomes null after the garbage collector calls the ReleaseAllHandles method in order to break the circular reference in the garbage created by the script.

Create an account

Register a new account

• Partner Spotlight

• Forum Statistics

• Total Topics
627638
• Total Posts
2978327

• 10
• 12
• 22
• 13
• 34