fixed the Memory leaks of async event and async processmessages

This commit is contained in:
helius 2019-10-21 16:35:44 +08:00
parent 99cea2f47a
commit 34894df1fb
1 changed files with 33 additions and 0 deletions

View File

@ -175,6 +175,21 @@ World::~World()
delete this->dataPtr;
this->dataPtr = nullptr;
////////////////Added by zenglei for Asyn event and processMessages///////////////
if (this->dataPtr->event_thread)
{
this->dataPtr->event_thread->join();
delete this->dataPtr->event_thread;
this->dataPtr->event_thread = nullptr;
}
if(this->dataPtr->async_processmessages_thread)
{
this->dataPtr->async_processmessages_thread->join();
delete this->dataPtr->async_processmessages_thread;
this->dataPtr->async_processmessages_thread = nullptr;
}
//////////////////////////////////////////////////////////////////////////////////
}
//////////////////////////////////////////////////
@ -1352,6 +1367,24 @@ void World::Fini()
delete this->dataPtr->thread;
this->dataPtr->thread = nullptr;
}
/////////////////Added for asyn event by zenglei/////////////////////
if (this->dataPtr->event_thread)
{
this->dataPtr->event_thread->join();
delete this->dataPtr->event_thread;
this->dataPtr->event_thread = nullptr;
}
if(this->dataPtr->async_processmessages_thread)
{
this->dataPtr->async_processmessages_thread->join();
delete this->dataPtr->async_processmessages_thread;
this->dataPtr->async_processmessages_thread = nullptr;
}
//////////////////////////////////////////////////////////////////////
}
//////////////////////////////////////////////////