mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Unlink Battleground and BattlegroundMap when one of them is deleted. Fix crash #3239.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -2593,6 +2593,12 @@ BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Ma
|
||||
|
||||
BattlegroundMap::~BattlegroundMap()
|
||||
{
|
||||
if(m_bg)
|
||||
{
|
||||
//unlink to prevent crash, always unlink all pointer reference before destruction
|
||||
m_bg->SetBgMap(NULL);
|
||||
m_bg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMap::InitVisibilityDistance()
|
||||
|
||||
Reference in New Issue
Block a user