[8719] More early detection possible crash sources at object deletion.

* If object still in world at delete
* If object still listed in client update queue

Possible with this crash reports will more informative and let find porblem.
This commit is contained in:
VladimirMangos 2009-10-24 01:59:50 +04:00
parent d7ae5e3af0
commit e79aa4dee2
3 changed files with 21 additions and 12 deletions

View file

@ -79,15 +79,22 @@ Object::Object( ) : m_PackGUID(sizeof(uint64)+1)
Object::~Object( ) Object::~Object( )
{ {
if(m_uint32Values)
{
if(IsInWorld()) if(IsInWorld())
{ {
///- Do NOT call RemoveFromWorld here, if the object is a player it will crash ///- Do NOT call RemoveFromWorld here, if the object is a player it will crash
sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still in world!!", GetGUIDLow(), GetTypeId()); sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still in world!!", GetGUIDLow(), GetTypeId());
//assert(0); ASSERT(false);
} }
if(m_objectUpdated)
{
sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still have updated status!!", GetGUIDLow(), GetTypeId());
ASSERT(false);
}
if(m_uint32Values)
{
//DEBUG_LOG("Object desctr 1 check (%p)",(void*)this); //DEBUG_LOG("Object desctr 1 check (%p)",(void*)this);
delete [] m_uint32Values; delete [] m_uint32Values;
delete [] m_uint32Values_mirror; delete [] m_uint32Values_mirror;
@ -735,11 +742,14 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
void Object::ClearUpdateMask(bool remove) void Object::ClearUpdateMask(bool remove)
{ {
if(m_uint32Values)
{
for( uint16 index = 0; index < m_valuesCount; ++index ) for( uint16 index = 0; index < m_valuesCount; ++index )
{ {
if(m_uint32Values_mirror[index]!= m_uint32Values[index]) if(m_uint32Values_mirror[index]!= m_uint32Values[index])
m_uint32Values_mirror[index] = m_uint32Values[index]; m_uint32Values_mirror[index] = m_uint32Values[index];
} }
}
if(m_objectUpdated) if(m_objectUpdated)
{ {

View file

@ -129,7 +129,6 @@ class MANGOS_DLL_SPEC Object
virtual void RemoveFromWorld() virtual void RemoveFromWorld()
{ {
// if we remove from world then sending changes not required // if we remove from world then sending changes not required
if(m_uint32Values)
ClearUpdateMask(true); ClearUpdateMask(true);
m_inWorld = false; m_inWorld = false;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8718" #define REVISION_NR "8719"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__