|
@@ -176,7 +176,7 @@ void LuaScript::ScriptSubscribeToEvent(const String& eventName, const String& fu
|
|
|
{
|
|
{
|
|
|
LuaFunctionVector& functions = eventHandleFunctions_[eventType];
|
|
LuaFunctionVector& functions = eventHandleFunctions_[eventType];
|
|
|
|
|
|
|
|
- HashSet<Object*>* receivers = context_->GetEventReceivers(eventType);
|
|
|
|
|
|
|
+ HashSet<Object*>* receivers = context_->GetEventReceivers(eventType);
|
|
|
if (!receivers || !receivers->Contains(this))
|
|
if (!receivers || !receivers->Contains(this))
|
|
|
SubscribeToEvent(eventType, HANDLER(LuaScript, HandleEvent));
|
|
SubscribeToEvent(eventType, HANDLER(LuaScript, HandleEvent));
|
|
|
|
|
|
|
@@ -227,14 +227,14 @@ void LuaScript::ScriptSubscribeToEvent(void* sender, const String& eventName, co
|
|
|
{
|
|
{
|
|
|
LuaFunctionVector& functions = objectHandleFunctions_[object][eventType];
|
|
LuaFunctionVector& functions = objectHandleFunctions_[object][eventType];
|
|
|
|
|
|
|
|
- HashSet<Object*>* receivers = context_->GetEventReceivers(object, eventType);
|
|
|
|
|
|
|
+ HashSet<Object*>* receivers = context_->GetEventReceivers(object, eventType);
|
|
|
if (!receivers || !receivers->Contains(this))
|
|
if (!receivers || !receivers->Contains(this))
|
|
|
{
|
|
{
|
|
|
- // When new object in same memory address
|
|
|
|
|
|
|
+ SubscribeToEvent(object, eventType, HANDLER(LuaScript, HandleObjectEvent));
|
|
|
|
|
+
|
|
|
|
|
+ // Fix issue #256
|
|
|
if (!functions.Empty())
|
|
if (!functions.Empty())
|
|
|
functions.Clear();
|
|
functions.Clear();
|
|
|
-
|
|
|
|
|
- SubscribeToEvent(object, eventType, HANDLER(LuaScript, HandleObjectEvent));
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!functions.Contains(function))
|
|
if (!functions.Contains(function))
|