mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 13:49:54 +00:00
MessageQueue: Fix destructor accessing Message properties after free
This was raised as a -Wmaybe-uninitialized warning by MinGW-GCC 15.2.1.
This commit is contained in:
parent
0687d5f29f
commit
318a9721b8
2 changed files with 6 additions and 7 deletions
|
|
@ -324,19 +324,18 @@ MessageQueue::~MessageQueue() {
|
|||
|
||||
while (read_pos < buffer_end) {
|
||||
Message *message = (Message *)&buffer[read_pos];
|
||||
read_pos += sizeof(Message);
|
||||
|
||||
Variant *args = (Variant *)(message + 1);
|
||||
int argc = message->args;
|
||||
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
||||
for (int i = 0; i < argc; i++) {
|
||||
args[i].~Variant();
|
||||
}
|
||||
read_pos += sizeof(Variant) * argc;
|
||||
}
|
||||
message->~Message();
|
||||
|
||||
read_pos += sizeof(Message);
|
||||
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
||||
read_pos += sizeof(Variant) * message->args;
|
||||
}
|
||||
message->~Message();
|
||||
}
|
||||
|
||||
singleton = nullptr;
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ class MessageQueue {
|
|||
|
||||
struct Message {
|
||||
Callable callable;
|
||||
int16_t type;
|
||||
int16_t type = 0;
|
||||
union {
|
||||
int16_t notification;
|
||||
int16_t notification = 0;
|
||||
int16_t args;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue