From 6ed32082e1c4dacfef92730e1c333beb4b6f3080 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Thu, 26 Oct 2023 11:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3HttpDispose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正HttpDispose --- .../Assets/TEngine/Runtime/Core/Utility/Utility.Http.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Http.cs b/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Http.cs index 635af55b..eee6fa49 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Http.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Http.cs @@ -91,6 +91,8 @@ namespace TEngine if (isCanceled) { Log.Warning($"HttpPost {unityWebRequest.url} be canceled!"); + unityWebRequest.Dispose(); + cts.Dispose(); } } catch (OperationCanceledException ex) @@ -98,11 +100,16 @@ namespace TEngine if (ex.CancellationToken == cts.Token) { Log.Warning("HttpPost Timeout"); + unityWebRequest.Dispose(); + cts.Dispose(); return string.Empty; } } - return unityWebRequest.downloadHandler.text; + string ret = unityWebRequest.downloadHandler.text; + unityWebRequest.Dispose(); + cts.Dispose(); + return ret; } } }