Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.27 KB | None | 0 0
  1. Index: src/arcemu-world/Creature.cpp
  2. ===================================================================
  3. --- src/arcemu-world/Creature.cpp   (revision 3692)
  4. +++ src/arcemu-world/Creature.cpp   (working copy)
  5. @@ -238,8 +238,9 @@
  6.  
  7.     if( _myScriptClass != NULL )
  8.     {
  9. -       _myScriptClass->Destroy();
  10. +       CreatureAIScript* script = _myScriptClass;
  11.         _myScriptClass = NULL;
  12. +       script->Destroy();
  13.     }
  14.  
  15.     if( IsTotem() )
  16. Index: src/arcemu-world/GameObject.cpp
  17. ===================================================================
  18. --- src/arcemu-world/GameObject.cpp (revision 3692)
  19. +++ src/arcemu-world/GameObject.cpp (working copy)
  20. @@ -72,8 +72,9 @@
  21.  
  22.     if(myScript != NULL)
  23.     {
  24. -       myScript->Destroy();
  25. +       GameObjectAIScript * script = myScript;
  26.         myScript = NULL;
  27. +       script->Destroy();
  28.     }
  29.  
  30.     uint32 guid = GetUInt32Value(OBJECT_FIELD_CREATED_BY);
  31. Index: src/arcemu-world/ScriptMgr.cpp
  32. ===================================================================
  33. --- src/arcemu-world/ScriptMgr.cpp  (revision 3692)
  34. +++ src/arcemu-world/ScriptMgr.cpp  (working copy)
  35. @@ -609,6 +609,13 @@
  36.  
  37.  CreatureAIScript::~CreatureAIScript()
  38.  {
  39. +   //GetScript() returns NULL if the destructor is called by Creature::~Creature()
  40. +   if( _unit->GetScript() != NULL )
  41. +   {
  42. +       sLog.outError("CreatureAIScript of Creature %u is not being deleted by Creature::~Creature()", _unit->GetEntry());
  43. +       Arcemu::Util::ARCEMU_ASSERT( false );
  44. +   }
  45. +
  46.     //notify our linked creature that we are being deleted.
  47.     if( linkedCreatureAI != NULL )
  48.         linkedCreatureAI->LinkedCreatureDeleted();
  49. Index: src/arcemu-world/ScriptMgr.h
  50. ===================================================================
  51. --- src/arcemu-world/ScriptMgr.h    (revision 3692)
  52. +++ src/arcemu-world/ScriptMgr.h    (working copy)
  53. @@ -292,7 +292,15 @@
  54.  {
  55.  public:
  56.     GameObjectAIScript(GameObject* goinstance);
  57. -   virtual ~GameObjectAIScript(){}
  58. +   virtual ~GameObjectAIScript()
  59. +   {
  60. +       //GetScript() returns NULL if the destructor is called by GameObject::~GameObject()
  61. +       if( _gameobject->GetScript() != NULL )
  62. +       {
  63. +           sLog.outError("GameObjectAIScript of GameObject %u is not being deleted by GameObject::~GameObject()", _gameobject->GetEntry());
  64. +           Arcemu::Util::ARCEMU_ASSERT( false );
  65. +       }
  66. +   }
  67.  
  68.     virtual void OnCreate() {}
  69.     virtual void OnSpawn() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement