Merge pull request #15429 from grpc/fix-conc-self

Fix self use in GRXConcurrentWriteable
pull/15559/head
Muxi Yan 7 years ago committed by GitHub
commit 4d6644ada8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/objective-c/RxLibrary/GRXConcurrentWriteable.m

@ -68,7 +68,7 @@
typeof(self) strongSelf = weakSelf; typeof(self) strongSelf = weakSelf;
if (strongSelf) { if (strongSelf) {
BOOL finished = NO; BOOL finished = NO;
@synchronized(self) { @synchronized(strongSelf) {
if (!strongSelf->_alreadyFinished) { if (!strongSelf->_alreadyFinished) {
strongSelf->_alreadyFinished = YES; strongSelf->_alreadyFinished = YES;
} else { } else {
@ -78,9 +78,9 @@
if (!finished) { if (!finished) {
// Cancellation is now impossible. None of the other three blocks can run concurrently with // Cancellation is now impossible. None of the other three blocks can run concurrently with
// this one. // this one.
[self.writeable writesFinishedWithError:nil]; [strongSelf.writeable writesFinishedWithError:nil];
// Skip any possible message to the wrapped writeable enqueued after this one. // Skip any possible message to the wrapped writeable enqueued after this one.
self.writeable = nil; strongSelf.writeable = nil;
} }
} }
}); });

Loading…
Cancel
Save