aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-05-05 20:19:47 +0200
committersfan5 <sfan5@live.de>2020-05-05 20:19:47 +0200
commitcb159f8d8af4556391db8a6875657625733eeb11 (patch)
treed9d56a16849e7d6cf1928ce1b8a58f382ae46189 /src
parentf3e87c53a5afc264e657acd99d3a39fbec3b63c9 (diff)
downloadminetest-cb159f8d8af4556391db8a6875657625733eeb11.tar.gz
minetest-cb159f8d8af4556391db8a6875657625733eeb11.tar.bz2
minetest-cb159f8d8af4556391db8a6875657625733eeb11.zip
Fix crash when exiting server during running mapgen
easily reproducible with a high num_emerge_threads and /emergeblocks
Diffstat (limited to 'src')
-rw-r--r--src/emerge.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp
index 6e05a45c9..a9fc0a4de 100644
--- a/src/emerge.cpp
+++ b/src/emerge.cpp
@@ -255,8 +255,9 @@ Mapgen *EmergeManager::getCurrentMapgen()
return nullptr;
for (u32 i = 0; i != m_threads.size(); i++) {
- if (m_threads[i]->isCurrentThread())
- return m_threads[i]->m_mapgen;
+ EmergeThread *t = m_threads[i];
+ if (t->isRunning() && t->isCurrentThread())
+ return t->m_mapgen;
}
return nullptr;
@@ -642,8 +643,7 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata,
/*
Clear generate notifier events
*/
- Mapgen *mg = m_emerge->getCurrentMapgen();
- mg->gennotify.clearEvents();
+ m_mapgen->gennotify.clearEvents();
EMERGE_DBG_OUT("ended up with: " << analyze_block(block));