summaryrefslogtreecommitdiffstats
path: root/core/templates/command_queue_mt.h
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2024-04-23 12:01:12 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2024-05-08 17:41:40 +0200
commit6f0760beb34ab8c27df11c7ce85f1e3994d0df89 (patch)
treec2efed1cbb0b226215a7b1e767b3fd34616a482b /core/templates/command_queue_mt.h
parentb834037841fef2603b23133e67340f470e46cf0f (diff)
downloadredot-engine-6f0760beb34ab8c27df11c7ce85f1e3994d0df89.tar.gz
CommandQueueMT: Fix command cleanup (revive destructor call + plus handle buffer realloc)
Diffstat (limited to 'core/templates/command_queue_mt.h')
-rw-r--r--core/templates/command_queue_mt.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h
index bb36f38d54..2ad5d1229d 100644
--- a/core/templates/command_queue_mt.h
+++ b/core/templates/command_queue_mt.h
@@ -302,7 +302,7 @@ class CommandQueueMT {
struct CommandBase {
bool sync = false;
virtual void call() = 0;
- virtual ~CommandBase() = default; // Won't be called.
+ virtual ~CommandBase() = default;
};
struct SyncCommand : public CommandBase {
@@ -368,6 +368,10 @@ class CommandQueueMT {
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;
}
WorkerThreadPool::thread_exit_command_queue_mt_flush();