This is really weird.
It only happens in my game when the player dies while the monster attack animation plays, and the scene clears after attack animation ends and a the idle animation starts.
The scene clear is used for a level restart, removing everything and re-creating the scene.
The assertions seems to originate from components deleting things on destruction.
Each time it’s one of the following:
delete compoundShape_;
in ~RigidBody()
btFreeDefault(void * ptr) Line 29 C++
btAlignedFreeDefault(void * ptr) Line 86 C++
btAlignedFreeInternal(void * ptr) Line 177 C++
btAlignedAllocator<btCompoundShapeChild,16>::deallocate(btCompoundShapeChild * ptr) Line 90 C++
btAlignedObjectArray<btCompoundShapeChild>::deallocate() Line 117 C++
btAlignedObjectArray<btCompoundShapeChild>::clear() Line 190 C++
btAlignedObjectArray<btCompoundShapeChild>::~btAlignedObjectArray<btCompoundShapeChild>() Line 134 C++
btCompoundShape::~btCompoundShape() Line 47 C++
[External Code]
Urho3D::RigidBody::~RigidBody() Line 97 C++
Some HashMap in ~PhysicsWorld()
operator delete[](void * ptr) Line 82 C++
Urho3D::AllocatorUninitialize(Urho3D::AllocatorBlock * allocator) Line 82 C++
Urho3D::HashMap<Urho3D::StringHash,Urho3D::Variant>::~HashMap<Urho3D::StringHash,Urho3D::Variant>() Line 246 C++
Urho3D::PhysicsWorld::~PhysicsWorld() Line 179 C++
When AnimationController is destroyed, and Vector<AnimationControl> animations_;
is destroyed.
If I don’t play the idle animation, the first kind of assertions stop happening (destruction ones), but I still get this assertion in asCContext::CleanReturnObject():
Which originates from ScriptFile::Execute().
I’m not sure but I think this one doesn’t originate from scene->Clear().
It also may happen when the idle animation is enabled but quite rarely.
I use a ScriptInstance on the scene node and have a script entry point “Main” class that derives from ScriptObject.
When the scene clears, the scriptInstance is removed, and when the level is reloaded a new scriptInstance is created. Maybe it causes problems with the script engine state?
I do derive a class from Script to register game level script API, could it cause this problem?
I’m using HEAD version (a2d8f8670e46565b74f1765c369f969c83cdf7c6)
VS2015
Windows 7 64bit
It seems like something went horribly wrong but I have no idea what.
And it only happens in that weird case of player dying while the monster AI is attacking and the scene is cleared after the attack animation is over.
If another animation starts after the attack is over it also changes the kind of error.