Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/arcemu-world/Creature.cpp
- ===================================================================
- --- src/arcemu-world/Creature.cpp (revision 3692)
- +++ src/arcemu-world/Creature.cpp (working copy)
- @@ -238,8 +238,9 @@
- if( _myScriptClass != NULL )
- {
- - _myScriptClass->Destroy();
- + CreatureAIScript* script = _myScriptClass;
- _myScriptClass = NULL;
- + script->Destroy();
- }
- if( IsTotem() )
- Index: src/arcemu-world/GameObject.cpp
- ===================================================================
- --- src/arcemu-world/GameObject.cpp (revision 3692)
- +++ src/arcemu-world/GameObject.cpp (working copy)
- @@ -72,8 +72,9 @@
- if(myScript != NULL)
- {
- - myScript->Destroy();
- + GameObjectAIScript * script = myScript;
- myScript = NULL;
- + script->Destroy();
- }
- uint32 guid = GetUInt32Value(OBJECT_FIELD_CREATED_BY);
- Index: src/arcemu-world/ScriptMgr.cpp
- ===================================================================
- --- src/arcemu-world/ScriptMgr.cpp (revision 3692)
- +++ src/arcemu-world/ScriptMgr.cpp (working copy)
- @@ -609,6 +609,13 @@
- CreatureAIScript::~CreatureAIScript()
- {
- + //GetScript() returns NULL if the destructor is called by Creature::~Creature()
- + if( _unit->GetScript() != NULL )
- + {
- + sLog.outError("CreatureAIScript of Creature %u is not being deleted by Creature::~Creature()", _unit->GetEntry());
- + Arcemu::Util::ARCEMU_ASSERT( false );
- + }
- +
- //notify our linked creature that we are being deleted.
- if( linkedCreatureAI != NULL )
- linkedCreatureAI->LinkedCreatureDeleted();
- Index: src/arcemu-world/ScriptMgr.h
- ===================================================================
- --- src/arcemu-world/ScriptMgr.h (revision 3692)
- +++ src/arcemu-world/ScriptMgr.h (working copy)
- @@ -292,7 +292,15 @@
- {
- public:
- GameObjectAIScript(GameObject* goinstance);
- - virtual ~GameObjectAIScript(){}
- + virtual ~GameObjectAIScript()
- + {
- + //GetScript() returns NULL if the destructor is called by GameObject::~GameObject()
- + if( _gameobject->GetScript() != NULL )
- + {
- + sLog.outError("GameObjectAIScript of GameObject %u is not being deleted by GameObject::~GameObject()", _gameobject->GetEntry());
- + Arcemu::Util::ARCEMU_ASSERT( false );
- + }
- + }
- virtual void OnCreate() {}
- virtual void OnSpawn() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement