aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-12-07 16:12:00 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-12-07 16:12:00 -0800
commit3f00d61b04874cc5f0159c16f2c598a8f2fb93a7 (patch)
tree584fd1143911811e142109528bd56dc04702c8fc /src/objective-c
parentdf21aab3a6af360cff29a5164f9728ba646d35ab (diff)
batch fix
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.m1
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.m18
2 files changed, 12 insertions, 7 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
index 9066cb950f..4edd9d3e37 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
@@ -320,6 +320,7 @@
_call = NULL;
}
}
+ // Explicitly converting weak reference _pooledChannel to strong.
__strong GRPCPooledChannel *channel = _pooledChannel;
[channel notifyWrappedCallDealloc:self];
}
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m
index 15b0f681ce..abf224c3cf 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.m
+++ b/src/objective-c/ProtoRPC/ProtoRPC.m
@@ -140,7 +140,11 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
}
- (void)start {
- [_call start];
+ GRPCCall2 *copiedCall;
+ @synchronized(self) {
+ copiedCall = _call;
+ }
+ [copiedCall start];
}
- (void)cancel {
@@ -177,20 +181,20 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
return;
}
- GRPCCall2 *call;
+ GRPCCall2 *copiedCall;
@synchronized(self) {
- call = _call;
+ copiedCall = _call;
}
- [call writeData:[message data]];
+ [copiedCall writeData:[message data]];
}
- (void)finish {
- GRPCCall2 *call;
+ GRPCCall2 *copiedCall;
@synchronized(self) {
- call = _call;
+ copiedCall = _call;
_call = nil;
}
- [call finish];
+ [copiedCall finish];
}
- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata {