mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
refactor(architecture): 将销毁方法改为异步实现
- 将Destroy方法替换为DestroyAsync异步方法 - 更新锚点绑定以使用异步销毁任务 - 在异步方法中保持相同的销毁逻辑 - 确保扩展组件正确分离和清理 - 维持原有的继承关系和调用链路
This commit is contained in:
parent
3db89ab498
commit
9ccfd7f49e
@ -85,7 +85,7 @@ public abstract class AbstractArchitecture(
|
||||
Name = _architectureAnchorName
|
||||
};
|
||||
|
||||
_anchor.Bind(Destroy);
|
||||
_anchor.Bind(() => DestroyAsync().AsTask());
|
||||
|
||||
tree.Root.CallDeferred(Node.MethodName.AddChild, _anchor);
|
||||
}
|
||||
@ -124,17 +124,18 @@ public abstract class AbstractArchitecture(
|
||||
/// 调用所有已安装扩展的OnDetach方法,并清空扩展列表。
|
||||
/// 若已被销毁则直接返回。
|
||||
/// </summary>
|
||||
public override void Destroy()
|
||||
public override async ValueTask DestroyAsync()
|
||||
{
|
||||
if (_destroyed)
|
||||
return;
|
||||
|
||||
_destroyed = true;
|
||||
|
||||
foreach (var ext in _extensions)
|
||||
ext.OnDetach();
|
||||
|
||||
_extensions.Clear();
|
||||
|
||||
base.Destroy();
|
||||
await base.DestroyAsync();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user