Unlink Battleground and BattlegroundMap when one of them is deleted. Fix crash #3239.

This commit is contained in:
megamage
2011-09-27 17:26:13 -04:00
parent 5f043e6291
commit eb946691c7
2 changed files with 11 additions and 0 deletions
@@ -220,7 +220,12 @@ Battleground::~Battleground()
sBattlegroundMgr->RemoveBattleground(GetInstanceID(), GetTypeID());
// unload map
if (m_Map)
{
m_Map->SetUnload();
//unlink to prevent crash, always unlink all pointer reference before destruction
m_Map->SetBG(NULL);
m_Map = NULL;
}
// remove from bg free slot queue
RemoveFromBGFreeSlotQueue();