I've got a class named "Bullet", and, as the name implies, it's a bullet that is spawned when the user presses the fire button. Now, the bullets are destroyed if the bullet travels far enough from the player or if the lifetime of the bullet exceeds
a certain amount of seconds.
I use body.Dispose() to get rid of the bullet bodies, but it causes random crashes every now and then. Sometimes I can shoot bullets for a few minutes, sometimes it crashes right on the first bullet.
The call stack tells me that the crash happens in DynamicTree.cs, in the Query() method. It's also weird that it's not always the same line of code - it varies every time. So far I've got call stacks to these rows:
int nodeId = _stack.Pop();
The exception I get is IndexOutOfRangeException.
What could possibly be the problem? The world and the body.Dispose() call are ran in the same thread, so it shouldn't be a threading problem as was the case with another problem in the earlier discussions.