Jump to content
  • Advertisement
Sign in to follow this  
Marcus L

A quite specific bug

This topic is 1485 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
Advertisement

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 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!