From 67b068e528ace4970cb21912ce9350cc1d0e292d Mon Sep 17 00:00:00 2001 From: rsgowman Date: Wed, 21 Feb 2018 12:09:05 -0500 Subject: 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. --- Firestore/Source/Util/FSTAsyncQueryListener.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Firestore/Source/Util') 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); } }]; }; -- cgit v1.2.3