Skip to content

Commit

Permalink
Fix emerge thread not cleaning up emerge queue on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and sapier committed Jan 7, 2015
1 parent 2b8ed9e commit ef140eb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/emerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ef140eb

Please sign in to comment.