Merge pull request #29001 from ibrahn/message-arg-destroy

MessageQueue::flush now always destroys parameters of a spent message
This commit is contained in:
Rémi Verschelde 2019-05-27 13:29:06 +02:00 committed by GitHub
commit 86f9d1bf5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -302,10 +302,6 @@ void MessageQueue::flush() {
_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;
case TYPE_NOTIFICATION: {
@ -319,11 +315,17 @@ void MessageQueue::flush() {
// messages don't expect a return value
target->set(message->target, *arg);
arg->~Variant();
} 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();
_THREAD_SAFE_LOCK_