File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 33
33
#import " Firestore/Source/Remote/FSTStream.h"
34
34
#import " Firestore/Source/Remote/FSTWatchChange.h"
35
35
#import " Firestore/Source/Util/FSTAssert.h"
36
+ #import " Firestore/Source/Util/FSTClasses.h"
36
37
#import " Firestore/Source/Util/FSTLogger.h"
37
38
38
39
#include " Firestore/core/src/firebase/firestore/auth/user.h"
@@ -503,8 +504,13 @@ - (void)processBatchedWatchChanges:(NSArray<FSTWatchChange *> *)changes
503
504
504
505
// Update in-memory resume tokens. FSTLocalStore will update the persistent view of these when
505
506
// applying the completed FSTRemoteEvent.
507
+ FSTWeakify (self);
506
508
[remoteEvent.targetChanges enumerateKeysAndObjectsUsingBlock: ^(
507
509
FSTBoxedTargetID *target, FSTTargetChange *change, BOOL *stop) {
510
+ FSTStrongify (self);
511
+ if (!self) {
512
+ return ;
513
+ }
508
514
NSData *resumeToken = change.resumeToken ;
509
515
if (resumeToken.length > 0 ) {
510
516
FSTQueryData *queryData = self->_listenTargets [target];
Original file line number Diff line number Diff line change 16
16
17
17
#import " Firestore/Source/Util/FSTAsyncQueryListener.h"
18
18
19
+ #import " Firestore/Source/Util/FSTClasses.h"
19
20
#import " Firestore/Source/Util/FSTDispatchQueue.h"
20
21
21
22
@implementation FSTAsyncQueryListener {
@@ -34,8 +35,18 @@ - (instancetype)initWithDispatchQueue:(FSTDispatchQueue *)dispatchQueue
34
35
}
35
36
36
37
- (FSTViewSnapshotHandler)asyncSnapshotHandler {
38
+ FSTWeakify (self);
37
39
return ^(FSTViewSnapshot *_Nullable snapshot, NSError *_Nullable error) {
40
+ FSTStrongify (self);
41
+ if (!self) {
42
+ return ;
43
+ }
44
+ FSTWeakify (self);
38
45
[self ->_dispatchQueue dispatchAsync: ^{
46
+ FSTStrongify (self);
47
+ if (!self) {
48
+ return ;
49
+ }
39
50
if (!self->_muted ) {
40
51
self->_snapshotHandler (snapshot, error);
41
52
}
You can’t perform that action at this time.
0 commit comments