Kaynağa Gözat

Add memory leak fix back, address deleting spell in spell effects already deleted by maintained

Emagi 11 ay önce
ebeveyn
işleme
34fa52efb9
1 değiştirilmiş dosya ile 8 ekleme ve 4 silme
  1. 8 4
      EQ2/source/WorldServer/Entity.cpp

+ 8 - 4
EQ2/source/WorldServer/Entity.cpp

@@ -131,10 +131,14 @@ void Entity::DeleteSpellEffects(bool removeClient)
 		}
 		if(GetInfoStruct()->spell_effects[i].spell_id != 0xFFFFFFFF)
 		{
-			/*if(GetInfoStruct()->spell_effects[i].spell && GetInfoStruct()->spell_effects[i].spell->spell && 
-				GetInfoStruct()->spell_effects[i].spell->spell->GetSpellData()->spell_book_type == SPELL_BOOK_TYPE_NOT_SHOWN) {
-				lua_interface->RemoveSpell(GetInfoStruct()->spell_effects[i].spell, false, removeClient, "", removeClient);
-			}*/
+			
+			if(deletedPtrs.find(GetInfoStruct()->spell_effects[i].spell) == deletedPtrs.end()) {
+				if(GetInfoStruct()->spell_effects[i].spell && GetInfoStruct()->spell_effects[i].spell->spell && 
+					GetInfoStruct()->spell_effects[i].spell->spell->GetSpellData()->spell_book_type == SPELL_BOOK_TYPE_NOT_SHOWN) {
+					lua_interface->RemoveSpell(GetInfoStruct()->spell_effects[i].spell, false, removeClient, "", removeClient);
+					deletedPtrs[GetInfoStruct()->spell_effects[i].spell] = true;
+				}
+			}
 			GetInfoStruct()->spell_effects[i].spell_id = 0xFFFFFFFF;
 			GetInfoStruct()->spell_effects[i].spell = nullptr;
 		}