mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 04:37:02 +00:00
[7257] Fixed unexpected errors in log and non-freed memory at battleground system shutdown.
This commit is contained in:
parent
0e37851a11
commit
6bacf2239f
5 changed files with 27 additions and 7 deletions
|
|
@ -1090,16 +1090,25 @@ BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTe
|
|||
|
||||
BattleGroundMgr::~BattleGroundMgr()
|
||||
{
|
||||
BattleGroundSet::iterator itr, next;
|
||||
for(itr = m_BattleGrounds.begin(); itr != m_BattleGrounds.end(); itr = next)
|
||||
DeleteAlllBattleGrounds();
|
||||
}
|
||||
|
||||
void BattleGroundMgr::DeleteAlllBattleGrounds()
|
||||
{
|
||||
for(BattleGroundSet::iterator itr = m_BattleGrounds.begin(); itr != m_BattleGrounds.end();)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
BattleGround * bg = itr->second;
|
||||
m_BattleGrounds.erase(itr);
|
||||
m_BattleGrounds.erase(itr++);
|
||||
delete bg;
|
||||
}
|
||||
m_BattleGrounds.clear();
|
||||
|
||||
// destroy template battlegrounds that listed only in queues (other already terminated)
|
||||
for(uint32 bgTypeId = 0; bgTypeId < MAX_BATTLEGROUND_TYPE_ID; ++bgTypeId)
|
||||
{
|
||||
// ~BattleGround call unregistring BG from queue
|
||||
while(!BGFreeSlotQueue[bgTypeId].empty())
|
||||
delete BGFreeSlotQueue[bgTypeId].front();
|
||||
}
|
||||
}
|
||||
|
||||
// used to update running battlegrounds, and delete finished ones
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue