Skip to content

Commit 6957b76

Browse files
paulb777ncooke3
andauthored
[ABT] Fix race crash (#16148)
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
1 parent dc18b7f commit 6957b76

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

FirebaseABTesting/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Unreleased
2+
- [fixed] Fixed a race condition that could lead to a crash in ABTesting when
3+
updating experiments. (#16145)
4+
15
# 10.16.0
26
- [fixed] Fix crash caused by empty experiment payload. (#11873)
37

FirebaseABTesting/Sources/FIRExperimentController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,15 @@ - (void)updateExperimentsWithServiceOrigin:(NSString *)origin
165165
payloads:(NSArray<NSData *> *)payloads
166166
completionHandler:
167167
(nullable void (^)(NSError *_Nullable error))completionHandler {
168+
NSArray<NSData *> *payloadsCopy = [payloads copy];
168169
FIRExperimentController *__weak weakSelf = self;
169170
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
170171
FIRExperimentController *strongSelf = weakSelf;
171172
[strongSelf updateExperimentConditionalUserPropertiesWithServiceOrigin:origin
172173
events:events
173174
policy:policy
174175
lastStartTime:lastStartTime
175-
payloads:payloads
176+
payloads:payloadsCopy
176177
completionHandler:completionHandler];
177178
});
178179
}

0 commit comments

Comments
 (0)