// Make a copy of the context pointer in case the object is destroyed during event handler invocation
Context* context = context_;
EventHandler* specific = nullptr;
EventHandler* nonSpecific = nullptr;
The comment “Make a copy …” really confuse me, the code Context* context = context_
really is a pointer assignment,
the content of context_ is not copied to context , so if context_
is destroyed , say context_ = nullptr
, so context
is also
be invalid to use, because they are point to the same address.
It will be appreciate if someone explain the code a bit more.
I recently wanted to learn an open source game engine, so I try to read the source and fing out what it was doing.