فهرست منبع

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

Emagi 11 ماه پیش
والد
کامیت
34fa52efb9
1فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  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;
 		}