summaryrefslogtreecommitdiff
path: root/src/emerge.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2015-01-04 01:01:30 +0100
committersapier <Sapier at GMX dot net>2015-01-07 12:19:48 +0100
commitef140eb7b0339d180cd38e3a98f5aa8abe604765 (patch)
tree700773f935894bb20567bb2b4093cb504fd0eb3d /src/emerge.cpp
parent2b8ed9e80c60b47b432d3997d9ddfcace420d5c4 (diff)
downloadminetest-ef140eb7b0339d180cd38e3a98f5aa8abe604765.tar.gz
minetest-ef140eb7b0339d180cd38e3a98f5aa8abe604765.tar.bz2
minetest-ef140eb7b0339d180cd38e3a98f5aa8abe604765.zip
Fix emerge thread not cleaning up emerge queue on shutdown
Diffstat (limited to 'src/emerge.cpp')
-rw-r--r--src/emerge.cpp17
1 files changed, 17 insertions, 0 deletions
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<v3s16, BlockEmergeData *>::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;