From 34f9778296959a25d192313a333f21f8e2865449 Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 3 Apr 2009 16:28:15 -0600 Subject: [PATCH] *Add some checks during object deconstruction. --HG-- branch : trunk --- src/game/Object.cpp | 2 ++ src/game/PetHandler.cpp | 2 +- src/game/Unit.cpp | 5 +++++ src/game/Unit.h | 3 +-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index c8fb721a22..b19a80fc7b 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -94,6 +94,8 @@ Object::~Object( ) assert(false); } + assert(!m_objectUpdated); + //DEBUG_LOG("Object desctr 1 check (%p)",(void*)this); delete [] m_uint32Values; delete [] m_uint32Values_mirror; diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 15f807a3cc..56845eaa65 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -69,7 +69,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) { //If a pet is dismissed, m_Controlled will change std::vector controlled; - for(ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) + for(Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) if((*itr)->GetEntry() == pet->GetEntry() && (*itr)->isAlive()) controlled.push_back(*itr); for(std::vector::iterator itr = controlled.begin(); itr != controlled.end(); ++itr) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3df54dfe6c..f9dfc24fac 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -187,6 +187,11 @@ Unit::~Unit() RemoveAllDynObjects(); if(m_charmInfo) delete m_charmInfo; + + assert(!m_attacking); + assert(m_attackers.empty()); + assert(m_sharedVision.empty()); + assert(m_Controlled.empty()); } void Unit::Update( uint32 p_time ) diff --git a/src/game/Unit.h b/src/game/Unit.h index be729616f2..ce59dbd62c 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -847,12 +847,11 @@ struct AuraSlotEntry struct SpellProcEventEntry; // used only privately -typedef std::set ControlList; - class TRINITY_DLL_SPEC Unit : public WorldObject { public: typedef std::set AttackerSet; + typedef std::set ControlList; typedef std::pair spellEffectPair; typedef std::multimap< spellEffectPair, Aura*> AuraMap; typedef std::list AuraList;