diff options
author | megamage <none@none> | 2009-03-31 09:18:39 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-31 09:18:39 -0600 |
commit | 031df598ab444ae4ed3d3d66996168d3577fb29d (patch) | |
tree | b85408862f7001e8dc43447bc74bd77ce817e93e /src/game/GameObject.cpp | |
parent | be89c6bb2a6a2c5f1a62e2010a9ee97efb8529b2 (diff) |
*Try to fix crash.
--HG--
branch : trunk
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r-- | src/game/GameObject.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index eb0dd10b7d4..5c945000579 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -63,7 +63,7 @@ GameObject::GameObject() : WorldObject() GameObject::~GameObject() { - if(m_uint32Values) // field array can be not exist if GameOBject not loaded + /*if(m_uint32Values) // field array can be not exist if GameOBject not loaded { // Possible crash at access to deleted GO in Unit::m_gameobj uint64 owner_guid = GetOwnerGUID(); @@ -75,7 +75,7 @@ GameObject::~GameObject() else if(!IS_PLAYER_GUID(owner_guid)) sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid)); } - } + }*/ } void GameObject::AddToWorld() @@ -93,6 +93,15 @@ void GameObject::RemoveFromWorld() ///- Remove the gameobject from the accessor if(IsInWorld()) { + // Possible crash at access to deleted GO in Unit::m_gameobj + if(uint64 owner_guid = GetOwnerGUID()) + { + Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid); + if(owner) + owner->RemoveGameObject(this,false); + else if(!IS_PLAYER_GUID(owner_guid)) + sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid)); + } WorldObject::RemoveFromWorld(); ObjectAccessor::Instance().RemoveObject(this); } |