From: sapier Date: Sun, 4 Jan 2015 00:01:30 +0000 (+0100) Subject: Fix emerge thread not cleaning up emerge queue on shutdown X-Git-Tag: 0.4.12~132 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ef140eb7b0339d180cd38e3a98f5aa8abe604765;p=oweals%2Fminetest.git Fix emerge thread not cleaning up emerge queue on shutdown --- diff --git a/src/emerge.cpp b/src/emerge.cpp index 8d8186126..e81793ff8 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -580,6 +580,23 @@ void *EmergeThread::Thread() m_server->setAsyncFatalError(err.str()); } + { + JMutexAutoLock queuelock(emerge->queuemutex); + while (!blockqueue.empty()) + { + v3s16 p = blockqueue.front(); + blockqueue.pop(); + + std::map::iterator iter; + iter = emerge->blocks_enqueued.find(p); + if (iter == emerge->blocks_enqueued.end()) + continue; //uh oh, queue and map out of sync!! + + BlockEmergeData *bedata = iter->second; + delete bedata; + } + } + END_DEBUG_EXCEPTION_HANDLER(errorstream) log_deregister_thread(); return NULL;