mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +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) {
|
while (read_pos < buffer_end) {
|
||||||
Message *message = (Message *)&buffer[read_pos];
|
Message *message = (Message *)&buffer[read_pos];
|
||||||
|
read_pos += sizeof(Message);
|
||||||
|
|
||||||
Variant *args = (Variant *)(message + 1);
|
Variant *args = (Variant *)(message + 1);
|
||||||
int argc = message->args;
|
int argc = message->args;
|
||||||
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
args[i].~Variant();
|
args[i].~Variant();
|
||||||
}
|
}
|
||||||
|
read_pos += sizeof(Variant) * argc;
|
||||||
}
|
}
|
||||||
message->~Message();
|
|
||||||
|
|
||||||
read_pos += sizeof(Message);
|
message->~Message();
|
||||||
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
|
||||||
read_pos += sizeof(Variant) * message->args;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
singleton = nullptr;
|
singleton = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,9 @@ class MessageQueue {
|
||||||
|
|
||||||
struct Message {
|
struct Message {
|
||||||
Callable callable;
|
Callable callable;
|
||||||
int16_t type;
|
int16_t type = 0;
|
||||||
union {
|
union {
|
||||||
int16_t notification;
|
int16_t notification = 0;
|
||||||
int16_t args;
|
int16_t args;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue