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);
|
AddChatLine(chatLine.Color, chatLine.Name, chatLine.Text, true);
|
||||||
|
|
||||||
orderManager.AddChatLine += AddChatLineWrapper;
|
orderManager.AddChatLine += AddChatLineWrapper;
|
||||||
Game.BeforeGameStart += UnregisterEvents;
|
|
||||||
|
|
||||||
chatText.IsDisabled = () => world.IsReplay && !Game.Settings.Debug.EnableDebugCommandsInReplays;
|
chatText.IsDisabled = () => world.IsReplay && !Game.Settings.Debug.EnableDebugCommandsInReplays;
|
||||||
|
|
||||||
@@ -177,12 +176,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterEvents()
|
|
||||||
{
|
|
||||||
orderManager.AddChatLine -= AddChatLineWrapper;
|
|
||||||
Game.BeforeGameStart -= UnregisterEvents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenChat()
|
public void OpenChat()
|
||||||
{
|
{
|
||||||
chatText.Text = "";
|
chatText.Text = "";
|
||||||
@@ -246,5 +239,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (!replayCache)
|
if (!replayCache)
|
||||||
Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
|
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