|
|
@@ -72,7 +72,8 @@ bool TypeInfo::IsTypeOf(const TypeInfo* typeInfo) const
|
|
|
}
|
|
|
|
|
|
Object::Object(Context* context) :
|
|
|
- context_(context)
|
|
|
+ context_(context),
|
|
|
+ blockEvents_(false)
|
|
|
{
|
|
|
assert(context_);
|
|
|
}
|
|
|
@@ -85,6 +86,8 @@ Object::~Object()
|
|
|
|
|
|
void Object::OnEvent(Object* sender, StringHash eventType, VariantMap& eventData)
|
|
|
{
|
|
|
+ if (blockEvents_)
|
|
|
+ return;
|
|
|
// Make a copy of the context pointer in case the object is destroyed during event handler invocation
|
|
|
Context* context = context_;
|
|
|
EventHandler* specific = nullptr;
|
|
|
@@ -299,6 +302,8 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (blockEvents_)
|
|
|
+ return;
|
|
|
// Make a weak pointer to self to check for destruction during event handling
|
|
|
WeakPtr<Object> self(this);
|
|
|
Context* context = context_;
|