Update AssetSystem

修复在资源加载完成回调内释放自身资源句柄时的异常报错。
This commit is contained in:
hevinci
2022-04-07 14:24:09 +08:00
parent efd0789e09
commit 28c22694ba
4 changed files with 10 additions and 14 deletions

View File

@@ -224,9 +224,14 @@ namespace YooAsset
}
protected void InvokeCompletion()
{
foreach (var handle in _handles)
// 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。
List<OperationHandleBase> tempers = new List<OperationHandleBase>(_handles);
foreach (var hande in tempers)
{
handle.InvokeCallback();
if (hande.IsValid)
{
hande.InvokeCallback();
}
}
_waitHandle?.Set();
}