From a4b83679b1c45313b57a7a2581547aacf9f3064f Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sat, 9 Aug 2025 21:41:24 +0300 Subject: [PATCH] chore: added todo for a rare bug --- Engine.Core/Helpers/Event.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Engine.Core/Helpers/Event.cs b/Engine.Core/Helpers/Event.cs index 13d112c..3b4a6db 100644 --- a/Engine.Core/Helpers/Event.cs +++ b/Engine.Core/Helpers/Event.cs @@ -5,6 +5,12 @@ using Engine.Core.Debug; namespace Engine.Core; +// TODO!: every reverse loop has a chance to have more than 1 unsubscription, +// for (int i = listeners.Count - 1; i >= 0; i--) +// can be replaced with +// for (int i = listeners.Count - 1; i >= 0; i = Math.Min(i - 1, listeners.Count - 1)) +// but this would causes possible double calls on already called callbacks, find a better method. + /// /// Represents a simple event with no parameters. /// Example usage: