diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-05-27 13:29:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-27 13:29:06 +0200 |
commit | 86f9d1bf5e7a5edf5e6f23a51414f2c375cdd0be (patch) | |
tree | ee30e39922538a89df67c8003d977bd6b3c62415 /core | |
parent | b9ee3f3d64365611499c23ab8b57006bf04a1107 (diff) | |
parent | 5626a1ec20b8df3faa0afd54787d08ccebed927d (diff) |
Merge pull request #29001 from ibrahn/message-arg-destroy
MessageQueue::flush now always destroys parameters of a spent message
Diffstat (limited to 'core')
-rw-r--r-- | core/message_queue.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 1d661f25f9..32d2b805f6 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -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_ |