Skip to content

Commit 6d09c52

Browse files
committed
Merge remote-tracking branch 'origin/main' into ah/ai-generable-macro
# Conflicts: # scripts/build.sh
2 parents 1888510 + 7865304 commit 6d09c52

File tree

7 files changed

+56
-45
lines changed

7 files changed

+56
-45
lines changed

FirebaseAuth/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Unreleased
1+
# 12.7.0
22
- [fixed] Add a mechanism to prevent concurrent token refreshes. (#15474)
3+
- [fixed] Fix "weak never mutated" build warning introduced in Xcode 26.2.
34

45
# 12.2.0
56
- [added] Added TOTP support for macOS.

FirebaseAuth/Sources/Swift/Auth/Auth.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,30 +1938,30 @@ extension Auth: AuthInterop {
19381938
"for the new token.")
19391939
}
19401940
autoRefreshScheduled = true
1941-
weak var weakSelf = self
1942-
authDispatcher.dispatch(afterDelay: delay, queue: kAuthGlobalWorkQueue) {
1943-
guard let strongSelf = weakSelf else {
1941+
authDispatcher.dispatch(afterDelay: delay, queue: kAuthGlobalWorkQueue) { [weak self] in
1942+
guard let self else {
19441943
return
19451944
}
1946-
guard strongSelf._currentUser?.rawAccessToken() == accessToken else {
1945+
guard self._currentUser?.rawAccessToken() == accessToken else {
19471946
// Another auto refresh must have been scheduled, so keep _autoRefreshScheduled unchanged.
19481947
return
19491948
}
1950-
strongSelf.autoRefreshScheduled = false
1951-
if strongSelf.isAppInBackground {
1949+
self.autoRefreshScheduled = false
1950+
if self.isAppInBackground {
19521951
return
19531952
}
1954-
let uid = strongSelf._currentUser?.uid
1955-
strongSelf._currentUser?
1956-
.internalGetToken(forceRefresh: true, backend: strongSelf.backend) { token, error in
1957-
if strongSelf._currentUser?.uid != uid {
1953+
let uid = self._currentUser?.uid
1954+
self._currentUser?
1955+
.internalGetToken(forceRefresh: true, backend: self.backend) { [weak self] token, error in
1956+
guard let self else { return }
1957+
if self._currentUser?.uid != uid {
19581958
return
19591959
}
19601960
if error != nil {
19611961
// Kicks off exponential back off logic to retry failed attempt. Starts with one minute
19621962
// delay (60 seconds) if this is the first failed attempt.
19631963
let rescheduleDelay = retry ? min(delay * 2, 16 * 60) : 60
1964-
strongSelf.scheduleAutoTokenRefresh(withDelay: rescheduleDelay, retry: true)
1964+
self.scheduleAutoTokenRefresh(withDelay: rescheduleDelay, retry: true)
19651965
}
19661966
}
19671967
}

FirebaseCore/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Unreleased
1+
# Firebase 12.7.0
22
- [fixed] [CocoaPods] Enable module map generation for Firebase pods. This
33
resolves build failures when using static linking
44
(`use_frameworks! :linkage => :static`) in projects using frameworks like

FirebaseDatabase/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 12.7.0
2+
- [fixed] Concurrency crash in FView. (#15514)
3+
14
# 11.9.0
25
- [fixed] Fix connection failure issue introduced in 10.27.0 by restoring the
36
Socket Rocket implementation instead of `NSURLSessionWebSocket`. Note that

FirebaseDatabase/Sources/Core/View/FView.m

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ @interface FView ()
7070
@property(nonatomic, strong, readwrite) FQuerySpec *query;
7171
@property(nonatomic, strong) FViewProcessor *processor;
7272
@property(nonatomic, strong) FViewCache *viewCache;
73+
74+
// All accesses must be guarded by @synchronized(self.eventRegistrations)
7375
@property(nonatomic, strong) NSMutableArray *eventRegistrations;
7476
@property(nonatomic, strong) FEventGenerator *eventGenerator;
7577

@@ -165,11 +167,15 @@ - (id)initWithQuery:(FQuerySpec *)query
165167
}
166168

167169
- (BOOL)isEmpty {
168-
return self.eventRegistrations.count == 0;
170+
@synchronized(self.eventRegistrations) {
171+
return self.eventRegistrations.count == 0;
172+
}
169173
}
170174

171175
- (void)addEventRegistration:(id<FEventRegistration>)eventRegistration {
172-
[self.eventRegistrations addObject:eventRegistration];
176+
@synchronized(self.eventRegistrations) {
177+
[self.eventRegistrations addObject:eventRegistration];
178+
}
173179
}
174180

175181
/**
@@ -181,31 +187,33 @@ - (void)addEventRegistration:(id<FEventRegistration>)eventRegistration {
181187
- (NSArray *)removeEventRegistration:(id<FEventRegistration>)eventRegistration
182188
cancelError:(NSError *)cancelError {
183189
NSMutableArray *cancelEvents = [[NSMutableArray alloc] init];
184-
if (cancelError != nil) {
185-
NSAssert(eventRegistration == nil,
186-
@"A cancel should cancel all event registrations.");
187-
FPath *path = self.query.path;
188-
for (id<FEventRegistration> registration in self.eventRegistrations) {
189-
FCancelEvent *maybeEvent =
190-
[registration createCancelEventFromError:cancelError path:path];
191-
if (maybeEvent) {
192-
[cancelEvents addObject:maybeEvent];
190+
@synchronized(self.eventRegistrations) {
191+
if (cancelError != nil) {
192+
NSAssert(eventRegistration == nil,
193+
@"A cancel should cancel all event registrations.");
194+
FPath *path = self.query.path;
195+
for (id<FEventRegistration> registration in self
196+
.eventRegistrations) {
197+
FCancelEvent *maybeEvent =
198+
[registration createCancelEventFromError:cancelError
199+
path:path];
200+
if (maybeEvent) {
201+
[cancelEvents addObject:maybeEvent];
202+
}
193203
}
194204
}
195-
}
196205

197-
if (eventRegistration) {
198-
NSUInteger i = 0;
199-
while (i < self.eventRegistrations.count) {
200-
id<FEventRegistration> existing = self.eventRegistrations[i];
201-
if ([existing matches:eventRegistration]) {
202-
[self.eventRegistrations removeObjectAtIndex:i];
203-
} else {
204-
i++;
205-
}
206+
if (eventRegistration) {
207+
NSIndexSet *indexesToRemove =
208+
[self.eventRegistrations indexesOfObjectsPassingTest:^BOOL(
209+
id<FEventRegistration> existing,
210+
NSUInteger idx, BOOL *stop) {
211+
return [existing matches:eventRegistration];
212+
}];
213+
[self.eventRegistrations removeObjectsAtIndexes:indexesToRemove];
214+
} else {
215+
[self.eventRegistrations removeAllObjects];
206216
}
207-
} else {
208-
[self.eventRegistrations removeAllObjects];
209217
}
210218
return cancelEvents;
211219
}
@@ -270,7 +278,10 @@ - (NSArray *)generateEventsForChanges:(NSArray *)changes
270278
registration:(id<FEventRegistration>)registration {
271279
NSArray *registrations;
272280
if (registration == nil) {
273-
registrations = [[NSArray alloc] initWithArray:self.eventRegistrations];
281+
@synchronized(self.eventRegistrations) {
282+
registrations =
283+
[[NSArray alloc] initWithArray:self.eventRegistrations];
284+
}
274285
} else {
275286
registrations = [[NSArray alloc] initWithObjects:registration, nil];
276287
}

FirebaseDatabase/Tests/Integration/FIRDatabaseQueryTests.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3563,7 +3563,6 @@ - (void)testListenForChildAddedWithLimitEnsureEventsFireProperly {
35633563
WAIT_FOR(count == 3);
35643564
}
35653565

3566-
#ifdef FLAKY_TEST
35673566
- (void)testListenForChildChangedWithLimitEnsureEventsFireProperly {
35683567
FTupleFirebase* refs = [FTestHelpers getRandomNodePair];
35693568
FIRDatabaseReference* writer = refs.one;
@@ -3603,7 +3602,6 @@ - (void)testListenForChildChangedWithLimitEnsureEventsFireProperly {
36033602

36043603
WAIT_FOR(count == 3);
36053604
}
3606-
#endif
36073605

36083606
- (void)testListenForChildRemovedWithLimitEnsureEventsFireProperly {
36093607
FTupleFirebase* refs = [FTestHelpers getRandomNodePair];

scripts/build.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,11 @@ database_emulator="${scripts_dir}/run_database_emulator.sh"
9393
system=$(uname -s)
9494
case "$system" in
9595
Darwin)
96-
architecture=$(uname -m)
9796
xcode_version=$(xcodebuild -version | grep Xcode)
9897
xcode_version="${xcode_version/Xcode /}"
9998
xcode_major="${xcode_version/.*/}"
10099
;;
101100
*)
102-
architecture="x86_64"
103101
xcode_major="0"
104102
;;
105103
esac
@@ -167,7 +165,7 @@ else
167165
ios_flags=(
168166
-destination "platform=iOS Simulator,name=${iphone_simulator_name}"
169167
)
170-
watchos_flags=(
168+
watchos_flags=(
171169
-destination 'platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)'
172170
)
173171
fi
@@ -181,7 +179,7 @@ ipad_flags=(
181179
)
182180

183181
macos_flags=(
184-
-destination "platform=OS X,arch=$architecture"
182+
-destination 'platform=OS X,arch=x86_64'
185183
)
186184
tvos_flags=(
187185
-destination 'platform=tvOS Simulator,name=Apple TV'
@@ -193,8 +191,8 @@ visionos_flags=(
193191
-destination 'platform=visionOS Simulator,OS=2.5,name=Apple Vision Pro'
194192
)
195193
catalyst_flags=(
196-
ARCHS=$architecture VALID_ARCHS=$architecture SUPPORTS_MACCATALYST=YES
197-
-destination platform="macOS,variant=Mac Catalyst,arch=$architecture" TARGETED_DEVICE_FAMILY=2
194+
ARCHS=x86_64 VALID_ARCHS=x86_64 SUPPORTS_MACCATALYST=YES
195+
-destination platform="macOS,variant=Mac Catalyst,arch=x86_64" TARGETED_DEVICE_FAMILY=2
198196
CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
199197
)
200198

0 commit comments

Comments
 (0)