Core/DynamicObject: Delete DynObjAura on DynObj delete, not on aura remove from object (prevents crashes)
This commit is contained in:
1 parent
2bef7477bb
commit
ebc9ead617
2 files changed
+7
-5
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user