mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
CommandQueueMT: Fix command cleanup (revive destructor call + plus handle buffer realloc)
This commit is contained in:
parent
b834037841
commit
6f0760beb3
@ -302,7 +302,7 @@ class CommandQueueMT {
|
|||||||
struct CommandBase {
|
struct CommandBase {
|
||||||
bool sync = false;
|
bool sync = false;
|
||||||
virtual void call() = 0;
|
virtual void call() = 0;
|
||||||
virtual ~CommandBase() = default; // Won't be called.
|
virtual ~CommandBase() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SyncCommand : public CommandBase {
|
struct SyncCommand : public CommandBase {
|
||||||
@ -368,6 +368,10 @@ class CommandQueueMT {
|
|||||||
sync_cond_var.notify_all();
|
sync_cond_var.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the command involved reallocating the buffer, the address may have changed.
|
||||||
|
cmd = reinterpret_cast<CommandBase *>(&command_mem[flush_read_ptr]);
|
||||||
|
cmd->~CommandBase();
|
||||||
|
|
||||||
flush_read_ptr += size;
|
flush_read_ptr += size;
|
||||||
}
|
}
|
||||||
WorkerThreadPool::thread_exit_command_queue_mt_flush();
|
WorkerThreadPool::thread_exit_command_queue_mt_flush();
|
||||||
|
Loading…
Reference in New Issue
Block a user