From d906ea05d6deefadb150d21ff80f0d74657515a8 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 16 Jun 2009 17:58:44 -0500 Subject: *Add a crashlog before an assert. --HG-- branch : trunk --- src/game/Object.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/game/Object.cpp') diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 0e7eed9bff0..1afd3ac3ae7 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -87,11 +87,15 @@ Object::~Object( ) if(IsInWorld()) { - sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId()); + sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); assert(false); } - assert(!m_objectUpdated); + if(m_objectUpdated) + { + sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); + assert(false); + } if(m_uint32Values) { -- cgit v1.2.3 From e405e6f9ede8c9ce5db647fdffb1dd6c008856eb Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 17 Jun 2009 09:57:22 -0500 Subject: *Fix a crash caused by mailed item deconstructor. --HG-- branch : trunk --- src/game/Object.cpp | 7 ++++--- src/game/Player.cpp | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/game/Object.cpp') diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 1afd3ac3ae7..3561621f0bd 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -82,19 +82,20 @@ Object::Object( ) : m_PackGUID(sizeof(uint64)+1) Object::~Object( ) { - //if(m_objectUpdated) - // ObjectAccessor::Instance().RemoveUpdateObject(this); - if(IsInWorld()) { sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); + if(isType(TYPEMASK_ITEM)) + sLog.outCrash("Item slot %u", ((Item*)this)->GetSlot()); assert(false); + RemoveFromWorld(); } if(m_objectUpdated) { sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); assert(false); + ObjectAccessor::Instance().RemoveUpdateObject(this); } if(m_uint32Values) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 02c7fa18e9f..07b3f62c3c5 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1844,6 +1844,9 @@ void Player::RemoveFromWorld() m_items[i]->RemoveFromWorld(); } + for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter) + iter->second->RemoveFromWorld(); + ///- Do not add/remove the player from the object storage ///- It will crash when updating the ObjectAccessor ///- The player should only be removed when logging out -- cgit v1.2.3