MessageQueue::flush now always destroys parameters of a spent message
Previously, destructors of Variant parameters were not called if the target of the message was not found.
This commit is contained in:
parent
33897d9b58
commit
5626a1ec20
|
@ -302,10 +302,6 @@ void MessageQueue::flush() {
|
||||||
|
|
||||||
_call_function(target, message->target, args, message->args, message->type & FLAG_SHOW_ERROR);
|
_call_function(target, message->target, args, message->args, message->type & FLAG_SHOW_ERROR);
|
||||||
|
|
||||||
for (int i = 0; i < message->args; i++) {
|
|
||||||
args[i].~Variant();
|
|
||||||
}
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TYPE_NOTIFICATION: {
|
case TYPE_NOTIFICATION: {
|
||||||
|
|
||||||
|
@ -319,11 +315,17 @@ void MessageQueue::flush() {
|
||||||
// messages don't expect a return value
|
// messages don't expect a return value
|
||||||
target->set(message->target, *arg);
|
target->set(message->target, *arg);
|
||||||
|
|
||||||
arg->~Variant();
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
||||||
|
Variant *args = (Variant *)(message + 1);
|
||||||
|
for (int i = 0; i < message->args; i++) {
|
||||||
|
args[i].~Variant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
message->~Message();
|
message->~Message();
|
||||||
|
|
||||||
_THREAD_SAFE_LOCK_
|
_THREAD_SAFE_LOCK_
|
||||||
|
|
Loading…
Reference in New Issue