Entities/Unit: Fix an issue where Unit pointers could be left dangling if a channeled Charm was interrupted by a control aura application. Closes #23440.
(cherry picked from commit f4b06fd0b7ead843bba8f5215a09abf7976e012c)
This commit is contained in:
@@ -458,12 +458,3 @@ void Puppet::Update(uint32 time)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Puppet::RemoveFromWorld()
|
||||
{
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
|
||||
RemoveCharmedBy(nullptr);
|
||||
Minion::RemoveFromWorld();
|
||||
}
|
||||
|
||||
@@ -138,7 +138,6 @@ class TC_GAME_API Puppet : public Minion
|
||||
void InitStats(uint32 duration) override;
|
||||
void InitSummon() override;
|
||||
void Update(uint32 time) override;
|
||||
void RemoveFromWorld() override;
|
||||
};
|
||||
|
||||
class TC_GAME_API ForcedUnsummonDelayEvent : public BasicEvent
|
||||
|
||||
@@ -25737,7 +25737,11 @@ void Player::SetClientControl(Unit* target, bool allowMove)
|
||||
{
|
||||
// still affected by some aura that shouldn't allow control, only allow on last such aura to be removed
|
||||
if (allowMove && target->HasUnitState(UNIT_STATE_CANT_CLIENT_CONTROL))
|
||||
{
|
||||
// this should never happen, otherwise m_unitBeingMoved might be left dangling!
|
||||
ASSERT(GetUnitBeingMoved() == target);
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPackets::Movement::ControlUpdate data;
|
||||
data.Guid = target->GetGUID();
|
||||
|
||||
@@ -10590,12 +10590,14 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
if (HasUnitState(state))
|
||||
return;
|
||||
|
||||
if (state & UNIT_STATE_CONTROLLED)
|
||||
CastStop();
|
||||
|
||||
AddUnitState(state);
|
||||
switch (state)
|
||||
{
|
||||
case UNIT_STATE_STUNNED:
|
||||
SetStunned(true);
|
||||
CastStop();
|
||||
break;
|
||||
case UNIT_STATE_ROOT:
|
||||
if (!HasUnitState(UNIT_STATE_STUNNED))
|
||||
@@ -10608,7 +10610,6 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
SendMeleeAttackStop();
|
||||
// SendAutoRepeatCancel ?
|
||||
SetConfused(true);
|
||||
CastStop();
|
||||
}
|
||||
break;
|
||||
case UNIT_STATE_FLEEING:
|
||||
@@ -10618,7 +10619,6 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
SendMeleeAttackStop();
|
||||
// SendAutoRepeatCancel ?
|
||||
SetFeared(true);
|
||||
CastStop();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user