From e1ef3e73027b381f7c4dfe9a4fabd97bc7b88cbe Mon Sep 17 00:00:00 2001 From: Rustam Gamidov <108531570+rustam-gamidov-here@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:35:45 +0300 Subject: [PATCH] OLPHttpTask to lock toIgnoreResponse before usage (#1560) It is 'synchronized' in the didCompleteWithError callback so it's better to add 'synchronized' in the restarting as well Relates-To: DATASDK-45 Signed-off-by: Rustam Gamidov --- olp-cpp-sdk-core/src/http/ios/OLPHttpTask.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/olp-cpp-sdk-core/src/http/ios/OLPHttpTask.mm b/olp-cpp-sdk-core/src/http/ios/OLPHttpTask.mm index bf26b8948..0bb9fa985 100644 --- a/olp-cpp-sdk-core/src/http/ios/OLPHttpTask.mm +++ b/olp-cpp-sdk-core/src/http/ios/OLPHttpTask.mm @@ -98,7 +98,9 @@ - (OLPHttpTaskStatus)restart { } if (_dataTask) { - _httpClient.toIgnoreResponse[_dataTask.taskDescription] = _dataTask; + @synchronized(_httpClient.toIgnoreResponse) { + _httpClient.toIgnoreResponse[_dataTask.taskDescription] = _dataTask; + } [_dataTask cancel]; _dataTask = nil; }