aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Util
diff options
context:
space:
mode:
authorGravatar rsgowman <rgowman@google.com>2018-02-21 12:09:05 -0500
committerGravatar GitHub <noreply@github.com>2018-02-21 12:09:05 -0500
commit67b068e528ace4970cb21912ce9350cc1d0e292d (patch)
treeb00a1a5075fdc9cfa721a807c3d4b16f89322685 /Firestore/Source/Util
parent14ea068f5fd03a658017f8472a4078a727fabc3a (diff)
Fix implicit retain self warnings (#808)
Xcode has starting warning about us implicitly retaining self references within blocks. This commit fixes it by explicitly mentioning self. No real changes are introduced here; this is effectively just making implicit behaviour explicit.
Diffstat (limited to 'Firestore/Source/Util')
-rw-r--r--Firestore/Source/Util/FSTAsyncQueryListener.mm11
1 files changed, 8 insertions, 3 deletions
diff --git a/Firestore/Source/Util/FSTAsyncQueryListener.mm b/Firestore/Source/Util/FSTAsyncQueryListener.mm
index d98e2dd..b72ac57 100644
--- a/Firestore/Source/Util/FSTAsyncQueryListener.mm
+++ b/Firestore/Source/Util/FSTAsyncQueryListener.mm
@@ -34,10 +34,15 @@
}
- (FSTViewSnapshotHandler)asyncSnapshotHandler {
+ // Retain `self` strongly in resulting snapshot handler so that even if the
+ // user releases the `FSTAsyncQueryListener` we'll continue to deliver
+ // events. This is done specifically to facilitate the common case where
+ // users just want to turn on notifications "forever" and don't want to have
+ // to keep track of our handle to keep them going.
return ^(FSTViewSnapshot *_Nullable snapshot, NSError *_Nullable error) {
- [_dispatchQueue dispatchAsync:^{
- if (!_muted) {
- _snapshotHandler(snapshot, error);
+ [self->_dispatchQueue dispatchAsync:^{
+ if (!self->_muted) {
+ self->_snapshotHandler(snapshot, error);
}
}];
};