fix: copy AppState via memcpy to avoid stack overflow

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-03 18:53:32 +00:00
parent 599afd748e
commit 8a2cfad077

View File

@@ -594,7 +594,7 @@ static void* dispatcher_thread_func(void *arg) {
// ============================================================ // ============================================================
DispatchFn dispatcher_init(AppState *initial_state) { DispatchFn dispatcher_init(AppState *initial_state) {
dispatcher.state = *initial_state; memcpy(&dispatcher.state, initial_state, sizeof(AppState));
atomic_store(&dispatcher.running, false); atomic_store(&dispatcher.running, false);
atomic_store(&dispatcher.write_index, 0); atomic_store(&dispatcher.write_index, 0);
atomic_store(&dispatcher.read_index, 0); atomic_store(&dispatcher.read_index, 0);