完善一些高危风险的代码容错机制。
This commit is contained in:
@@ -188,11 +188,19 @@ namespace YooAsset
|
||||
// 结束记录
|
||||
DebugEndRecording();
|
||||
|
||||
//注意:如果完成回调内发生异常,会导致Task无限期等待
|
||||
_callback?.Invoke(this);
|
||||
|
||||
if (_taskCompletionSource != null)
|
||||
_taskCompletionSource.TrySetResult(null);
|
||||
try
|
||||
{
|
||||
_callback?.Invoke(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
YooLogger.Error($"Exception in completion callback: {ex}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_taskCompletionSource != null)
|
||||
_taskCompletionSource.TrySetResult(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user