Merge pull request #14874 from grpc/retain-self-late

Release self retain only after all clean-up done
pull/14887/head
Muxi Yan 7 years ago committed by GitHub
commit 69d876ff6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/objective-c/GRPCClient/GRPCCall.m

@ -196,9 +196,6 @@ static NSString * const kBearerPrefix = @"Bearer ";
_state = GRXWriterStateFinished; _state = GRXWriterStateFinished;
} }
// If the call isn't retained anywhere else, it can be deallocated now.
_retainSelf = nil;
// If there were still request messages coming, stop them. // If there were still request messages coming, stop them.
@synchronized(_requestWriter) { @synchronized(_requestWriter) {
_requestWriter.state = GRXWriterStateFinished; _requestWriter.state = GRXWriterStateFinished;
@ -211,6 +208,9 @@ static NSString * const kBearerPrefix = @"Bearer ";
} }
[GRPCConnectivityMonitor unregisterObserver:self]; [GRPCConnectivityMonitor unregisterObserver:self];
// If the call isn't retained anywhere else, it can be deallocated now.
_retainSelf = nil;
} }
- (void)cancelCall { - (void)cancelCall {

Loading…
Cancel
Save