فهرست منبع

deadlock fix in chareffectlist and fixes #3382 npe

Sami 16 سال پیش
والد
کامیت
0e3a1acb72

+ 12 - 5
L2_GameServer/java/net/sf/l2j/gameserver/model/CharEffectList.java

@@ -467,7 +467,8 @@ public class CharEffectList
 		}
 
 		FastList<L2Effect> effectList = newEffect.getSkill().isDebuff() ? _debuffs : _buffs;
-		L2Effect tempEffect, tempEffect2;
+		L2Effect tempEffect = null, tempEffect2 = null;
+		boolean stopNewEffect = false;
 
 		synchronized(effectList)
 		{
@@ -480,19 +481,25 @@ public class CharEffectList
 						&& e.getStackOrder() == newEffect.getStackOrder())
 				{
 					if (!newEffect.getSkill().isDebuff())
-						e.exit();
+					{
+						tempEffect = e; // exit this
+						break;
+					}
 					else
 					{
 						// Started scheduled timer needs to be canceled.
-						newEffect.stopEffectTask();
-						return;
+						stopNewEffect = true;
+						break;
 					}
 				}
 			}
 		}
 
+		if (tempEffect != null) 
+			tempEffect.exit();
+		
 		// if max buffs, no herb effects are used, even if they would replace one old
-		if (getBuffCount() >= _owner.getMaxBuffCount() && newEffect.isHerbEffect())
+		if (stopNewEffect || (getBuffCount() >= _owner.getMaxBuffCount() && newEffect.isHerbEffect()))
 		{ 
 			newEffect.stopEffectTask(); 
 			return; 

+ 2 - 0
L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestManorList.java

@@ -38,6 +38,8 @@ public class RequestManorList extends L2GameClientPacket
 	protected void runImpl()
 	{
 		L2PcInstance player = getClient().getActiveChar();
+		if (player == null) 
+			return;
 		FastList<String> manorsName = new FastList<String>();
 		manorsName.add("gludio");
 		manorsName.add("dion");