summaryrefslogtreecommitdiff
path: root/scripts/GUI/MessageLog.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/GUI/MessageLog.cs')
-rw-r--r--scripts/GUI/MessageLog.cs17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/GUI/MessageLog.cs b/scripts/GUI/MessageLog.cs
index 1fc59b6..c83879a 100644
--- a/scripts/GUI/MessageLog.cs
+++ b/scripts/GUI/MessageLog.cs
@@ -8,6 +8,7 @@ public partial class MessageLog : ScrollContainer
{
private VBoxContainer MessageList { get; set; }
+ private MessageLogData.messageSentEventHandler joinSignal;
public override void _Ready()
{
base._Ready();
@@ -18,7 +19,21 @@ public partial class MessageLog : ScrollContainer
_ = AddMessageAsync(msg);
}
- MessageLogData.Instance.messageSent += async (Message msg) => await AddMessageAsync(msg);
+ joinSignal = async (Message msg) => await AddMessageAsync(msg);
+
+ MessageLogData.Instance.messageSent += joinSignal;
+ }
+
+ public override void _Notification(int what)
+ {
+ if (what == NotificationPredelete)
+ {
+ if (joinSignal != null)
+ {
+ MessageLogData.Instance.messageSent -= joinSignal;
+ }
+ }
+ base._Notification(what);
}
private async Task AddMessageAsync(Message message)