mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 21:57:01 +01:00
Core/DynamicObject: Delete DynObjAura on DynObj delete, not on aura remove from object (prevents crashes)
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
DynamicObject::DynamicObject() : WorldObject(),
|
||||
_aura(NULL), _caster(NULL), _duration(0), _isViewpoint(false)
|
||||
_aura(NULL), _removedAura(NULL), _caster(NULL), _duration(0), _isViewpoint(false)
|
||||
{
|
||||
m_objectType |= TYPEMASK_DYNAMICOBJECT;
|
||||
m_objectTypeId = TYPEID_DYNAMICOBJECT;
|
||||
@@ -44,6 +44,7 @@ DynamicObject::~DynamicObject()
|
||||
ASSERT(!_aura);
|
||||
ASSERT(!_caster);
|
||||
ASSERT(!_isViewpoint);
|
||||
delete _removedAura;
|
||||
}
|
||||
|
||||
void DynamicObject::AddToWorld()
|
||||
@@ -178,11 +179,11 @@ void DynamicObject::SetAura(Aura* aura)
|
||||
|
||||
void DynamicObject::RemoveAura()
|
||||
{
|
||||
ASSERT(_aura);
|
||||
if (!_aura->IsRemoved())
|
||||
_aura->_Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
delete _aura;
|
||||
ASSERT(_aura && !_removedAura);
|
||||
_removedAura = _aura;
|
||||
_aura = NULL;
|
||||
if (!_removedAura->IsRemoved())
|
||||
_removedAura->_Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
}
|
||||
|
||||
void DynamicObject::SetCasterViewpoint()
|
||||
|
||||
@@ -66,6 +66,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>
|
||||
|
||||
protected:
|
||||
Aura* _aura;
|
||||
Aura* _removedAura;
|
||||
Unit* _caster;
|
||||
int32 _duration; // for non-aura dynobjects
|
||||
bool _isViewpoint;
|
||||
|
||||
Reference in New Issue
Block a user