From e5bd972ee7dad1c96d9606ed9776f222e5251451 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:07:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(coroutine):=20=E4=BF=AE=E5=A4=8D=E5=8D=8F?= =?UTF-8?q?=E7=A8=8B=E8=B0=83=E5=BA=A6=E5=99=A8=E4=B8=AD=E7=9A=84=E6=BD=9C?= =?UTF-8?q?=E5=9C=A8=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在KillByTag方法中创建句柄数组副本以避免集合被修改的异常 - 修复Complete方法的缩进格式问题 - 为WaitCommandSwitch添加默认分支以处理未知类型的等待指令 --- GFramework.Core/coroutine/CoroutineScheduler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GFramework.Core/coroutine/CoroutineScheduler.cs b/GFramework.Core/coroutine/CoroutineScheduler.cs index 8c20f38..eec8b37 100644 --- a/GFramework.Core/coroutine/CoroutineScheduler.cs +++ b/GFramework.Core/coroutine/CoroutineScheduler.cs @@ -395,7 +395,8 @@ public sealed class CoroutineScheduler( if (!_tagged.TryGetValue(tag, out var handles)) return 0; - return handles.Count(Kill); + var copy = handles.ToArray(); + return copy.Count(Kill); } /// @@ -486,6 +487,9 @@ public sealed class CoroutineScheduler( case WaitForCoroutine wfc: wfc.Complete(); break; + default: + // 其他类型的等待指令不需要特殊处理 + break; } s.State = CoroutineState.Running;