aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient/private
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-04-17 14:39:25 -0700
committerGravatar Muxi Yan <mxyan@google.com>2018-04-17 14:39:25 -0700
commitbc1a1b4411aa6e6e955a95f9219a9afb009274e6 (patch)
tree0b86d642310a4cbf0f675cd5f468379982f8808f /src/objective-c/GRPCClient/private
parentbb5482f944e6d3964b15552ec08b69afd2b1ff17 (diff)
Comment on the fix
Diffstat (limited to 'src/objective-c/GRPCClient/private')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.m3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m
index 07cfe1329b..bfb1fd352c 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.m
+++ b/src/objective-c/GRPCClient/private/GRPCHost.m
@@ -108,6 +108,9 @@ static NSMutableDictionary *kHostCache;
serverName:(NSString *)serverName
timeout:(NSTimeInterval)timeout
completionQueue:(GRPCCompletionQueue *)queue {
+ // The __block attribute is to allow channel take refcount inside @synchronized block. Without
+ // this attribute, retain of channel object happens after objc_sync_exit in release builds, which
+ // may result in channel released before used. See grpc/#15033.
__block GRPCChannel *channel;
// This is racing -[GRPCHost disconnect].
@synchronized(self) {