Core/Vehicles: Fix a crash in ~Vehicle. Closes #5366

This commit is contained in:
Machiavelli
2012-02-22 16:51:56 +01:00
parent 656f8f8d04
commit c9748aaacc
+5 -1
View File
@@ -281,7 +281,6 @@ Unit::~Unit()
_DeleteRemovedAuras(); _DeleteRemovedAuras();
delete m_charmInfo; delete m_charmInfo;
delete m_vehicleKit;
delete movespline; delete movespline;
ASSERT(!m_duringRemoveFromWorld); ASSERT(!m_duringRemoveFromWorld);
@@ -13683,7 +13682,11 @@ void Unit::RemoveFromWorld()
{ {
m_duringRemoveFromWorld = true; m_duringRemoveFromWorld = true;
if (IsVehicle()) if (IsVehicle())
{
GetVehicleKit()->Uninstall(); GetVehicleKit()->Uninstall();
delete m_vehicleKit;
m_vehicleKit = NULL;
}
RemoveCharmAuras(); RemoveCharmAuras();
RemoveBindSightAuras(); RemoveBindSightAuras();
@@ -13692,6 +13695,7 @@ void Unit::RemoveFromWorld()
RemoveAllGameObjects(); RemoveAllGameObjects();
RemoveAllDynObjects(); RemoveAllDynObjects();
ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
UnsummonAllTotems(); UnsummonAllTotems();
RemoveAllControlled(); RemoveAllControlled();