diff --git a/src/objective-c/ProtoRPC/ProtoMethod.m b/src/objective-c/ProtoRPC/ProtoMethod.m index 4bef10af0e2..ed585acfb96 100644 --- a/src/objective-c/ProtoRPC/ProtoMethod.m +++ b/src/objective-c/ProtoRPC/ProtoMethod.m @@ -18,7 +18,10 @@ #import "ProtoMethod.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoMethod +#pragma clang diagnostic pop - (instancetype)initWithPackage:(NSString *)package service:(NSString *)service method:(NSString *)method { diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 1ecfcc5b0ef..20b9d04cd84 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -42,7 +42,10 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing userInfo:info]; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoRPC { +#pragma clang diagnostic pop id _responseWriteable; } diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index be6089f0a46..611cee46bfc 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -24,7 +24,10 @@ #import "ProtoMethod.h" #import "ProtoRPC.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoService { +#pragma clang diagnostic pop NSString *_host; NSString *_packageName; NSString *_serviceName; diff --git a/src/objective-c/RxLibrary/GRXConcurrentWriteable.m b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m index 37bc975f874..c2623134960 100644 --- a/src/objective-c/RxLibrary/GRXConcurrentWriteable.m +++ b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m @@ -64,21 +64,25 @@ } - (void)enqueueSuccessfulCompletion { + __weak typeof(self) weakSelf = self; dispatch_async(_writeableQueue, ^{ - BOOL finished = NO; - @synchronized (self) { - if (!_alreadyFinished) { - _alreadyFinished = YES; - } else { - finished = YES; + typeof(self) strongSelf = weakSelf; + if (strongSelf) { + BOOL finished = NO; + @synchronized (self) { + if (!strongSelf->_alreadyFinished) { + strongSelf->_alreadyFinished = YES; + } else { + finished = YES; + } + } + if (!finished) { + // Cancellation is now impossible. None of the other three blocks can run concurrently with + // this one. + [self.writeable writesFinishedWithError:nil]; + // Skip any possible message to the wrapped writeable enqueued after this one. + self.writeable = nil; } - } - if (!finished) { - // Cancellation is now impossible. None of the other three blocks can run concurrently with - // this one. - [self.writeable writesFinishedWithError:nil]; - // Skip any possible message to the wrapped writeable enqueued after this one. - self.writeable = nil; } }); }