[ElmSharp] Fix EcoreEvent (#2988)
authorJay Cho <chojoong@gmail.com>
Mon, 3 May 2021 07:35:50 +0000 (16:35 +0900)
committerGitHub <noreply@github.com>
Mon, 3 May 2021 07:35:50 +0000 (16:35 +0900)
src/ElmSharp/ElmSharp/EcoreEvent.cs

index 8b5ac84f795532c68cde05bd997c94260f32a783..7dfb3d3a055f0b5b0be74d3f6e3632748c4c8008 100644 (file)
@@ -188,10 +188,11 @@ namespace ElmSharp
             remove
             {
                 EventHandler<TEventArgs> handler = value;
-                var callbacks = _nativeCallbacks.Where(cb => cb.eventHandler == handler);
+                var callbacks = _nativeCallbacks.Where(cb => cb.eventHandler == handler).ToList();
                 foreach (var cb in callbacks)
                 {
                     Interop.Ecore.ecore_event_handler_del(cb.nativeHandler);
+                    _nativeCallbacks.Remove(cb);
                 }
             }
         }