I created a massive headache for myself recently - I had smashed out a bunch of classes deriving from Serializable, created a tree of specialized nodes (a custom set of derived node classes, nothing to do with Urho3D::Node), and during destruction, I was landing in Context::RemoveEventReceiver, on my deepest node (initially), with pthis=nullptr
As my project pulls in the (release) Urho lib, I could not easily investigate the cause of the crash, but I do know my way around ASM, and I was able to inspect the disassembled code and the CPU registers to figure out that one of my objects had not correctly initialized the context_ member.
The issue was caused as follows:
MyClass::MyClass(Context* context):ItsAncestor(context_) { }
Can you see the problem?
It’s such a subtle bug, but it’s super-nasty.
The input argument “context” is valid on entry - but that’s not what we handed to the ancestor!
Just a friendly heads-up incase someone else is wondering why their code crashes silently!