mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
fix(coroutine): 修复协程调度器中的潜在异常问题
- 在KillByTag方法中创建句柄数组副本以避免集合被修改的异常 - 修复Complete方法的缩进格式问题 - 为WaitCommandSwitch添加默认分支以处理未知类型的等待指令
This commit is contained in:
parent
74f27ddfd5
commit
e5bd972ee7
@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -486,6 +487,9 @@ public sealed class CoroutineScheduler(
|
||||
case WaitForCoroutine wfc:
|
||||
wfc.Complete();
|
||||
break;
|
||||
default:
|
||||
// 其他类型的等待指令不需要特殊处理
|
||||
break;
|
||||
}
|
||||
|
||||
s.State = CoroutineState.Running;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user