A quite specific bug

Started by
1 comment, last by WitchLord 9 years, 10 months ago

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!

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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement