forked from Mirrorlandia_minetest/minetest
Fix crash when exiting server during running mapgen
easily reproducible with a high num_emerge_threads and /emergeblocks
This commit is contained in:
parent
f3e87c53a5
commit
cb159f8d8a
@ -255,8 +255,9 @@ Mapgen *EmergeManager::getCurrentMapgen()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (u32 i = 0; i != m_threads.size(); i++) {
|
for (u32 i = 0; i != m_threads.size(); i++) {
|
||||||
if (m_threads[i]->isCurrentThread())
|
EmergeThread *t = m_threads[i];
|
||||||
return m_threads[i]->m_mapgen;
|
if (t->isRunning() && t->isCurrentThread())
|
||||||
|
return t->m_mapgen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -642,8 +643,7 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata,
|
|||||||
/*
|
/*
|
||||||
Clear generate notifier events
|
Clear generate notifier events
|
||||||
*/
|
*/
|
||||||
Mapgen *mg = m_emerge->getCurrentMapgen();
|
m_mapgen->gennotify.clearEvents();
|
||||||
mg->gennotify.clearEvents();
|
|
||||||
|
|
||||||
EMERGE_DBG_OUT("ended up with: " << analyze_block(block));
|
EMERGE_DBG_OUT("ended up with: " << analyze_block(block));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user