diff --git a/FirebasePerformance/CHANGELOG.md b/FirebasePerformance/CHANGELOG.md index e1f7548eec1..0863831c286 100644 --- a/FirebasePerformance/CHANGELOG.md +++ b/FirebasePerformance/CHANGELOG.md @@ -1,3 +1,6 @@ +# Unreleased +- [fixed] Fix a crash related to thread sanitization on FPRNetworkTrace class (#13581). + # 10.28.0 - Fix Crash from InstrumentUploadTaskWithStreamedRequest (#12983). - Replace SystemConfiguration with a more recent network monitoring API by Apple (#13079). diff --git a/FirebasePerformance/Sources/Instrumentation/FPRNetworkTrace.m b/FirebasePerformance/Sources/Instrumentation/FPRNetworkTrace.m index f08015c8cf4..380e57dae0e 100644 --- a/FirebasePerformance/Sources/Instrumentation/FPRNetworkTrace.m +++ b/FirebasePerformance/Sources/Instrumentation/FPRNetworkTrace.m @@ -233,7 +233,9 @@ - (NSTimeInterval)startTimeSinceEpoch { #pragma mark - Overrides - (void)setResponseCode:(int32_t)responseCode { - _responseCode = responseCode; + dispatch_sync(self.syncQueue, ^{ + _responseCode = responseCode; + }); if (responseCode != 0) { _hasValidResponseCode = YES; } @@ -279,7 +281,9 @@ - (void)didUploadFileWithURL:(NSURL *)URL { } - (void)didReceiveData:(NSData *)data { - self.responseSize = data.length; + dispatch_sync(self.syncQueue, ^{ + self.responseSize = data.length; + }); } - (void)didReceiveFileURL:(NSURL *)URL { @@ -290,7 +294,9 @@ - (void)didReceiveFileURL:(NSURL *)URL { if (error) { FPRLogNotice(kFPRNetworkTraceFileError, @"Unable to determine the size of file."); } else { - self.responseSize = value.unsignedIntegerValue; + dispatch_sync(self.syncQueue, ^{ + self.responseSize = value.unsignedIntegerValue; + }); } } }