Remove AddChatLine registration on IngameChatLogic dispose.
This commit is contained in:
@@ -145,7 +145,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
AddChatLine(chatLine.Color, chatLine.Name, chatLine.Text, true);
|
||||
|
||||
orderManager.AddChatLine += AddChatLineWrapper;
|
||||
Game.BeforeGameStart += UnregisterEvents;
|
||||
|
||||
chatText.IsDisabled = () => world.IsReplay && !Game.Settings.Debug.EnableDebugCommandsInReplays;
|
||||
|
||||
@@ -177,12 +176,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
return true;
|
||||
}
|
||||
|
||||
void UnregisterEvents()
|
||||
{
|
||||
orderManager.AddChatLine -= AddChatLineWrapper;
|
||||
Game.BeforeGameStart -= UnregisterEvents;
|
||||
}
|
||||
|
||||
public void OpenChat()
|
||||
{
|
||||
chatText.Text = "";
|
||||
@@ -246,5 +239,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (!replayCache)
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
|
||||
}
|
||||
|
||||
bool disposed = false;
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
orderManager.AddChatLine -= AddChatLineWrapper;
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user