From e2207eec68e5ee82b79d76ec3e800079b1606cf3 Mon Sep 17 00:00:00 2001 From: Sara Date: Tue, 3 Mar 2026 16:48:49 +0100 Subject: [PATCH] fix: check if threads are started before waiting --- modules/terrain/terrain.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/terrain/terrain.cpp b/modules/terrain/terrain.cpp index 5ef9f828..a0d96d56 100644 --- a/modules/terrain/terrain.cpp +++ b/modules/terrain/terrain.cpp @@ -75,7 +75,9 @@ void Terrain::_notification(int what) { this->threads_stop = true; this->workload_lock.unlock(); for (Thread &thread : this->threads) { - thread.wait_to_finish(); + if (thread.is_started()) { + thread.wait_to_finish(); + } } return; } @@ -115,7 +117,9 @@ void Terrain::construct_chunk_grid() { this->threads_stop = true; this->workload_lock.unlock(); for (Thread &thread : this->threads) { - thread.wait_to_finish(); + if (thread.is_started()) { + thread.wait_to_finish(); + } } this->workload_lock.lock(); for (TerrainChunkMesh *mesh : this->meshes) {