Sign in to follow this  

A quite specific bug

This topic is 1273 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi again smile.png
So continuing down the road that is circular references, I've now stumbled upon what I suspect is a awfully specific bug.
I've created this simple example to illustrate: (I'm here using your any-addon, array-addon and grid-addon)
 

// 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 smile.png !)
 

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 tongue.png

Thanks in advance!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

This topic is 1273 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this