Skip to content

Commit a8f11e6

Browse files
committed
SSYInterappServer now temporarily maintains its delegate in case external actors release it too soon.
1 parent 061dae8 commit a8f11e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

SSYInterappServer.m

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ CFDataRef SSYInterappServerCallBackCreateData(
7676
SSYInterappServer* server = (__bridge SSYInterappServer*)info ;
7777

7878
NSObject <SSYInterappServerDelegate> * delegate = [server delegate] ;
79+
/* We temporarily retain the delegate in case the delegate in case
80+
external actors release it too soon. */
81+
[delegate retain];
7982
[delegate interappServer:server
8083
didReceiveHeaderByte:headerByte
8184
data:rxPayload] ;
@@ -84,6 +87,7 @@ CFDataRef SSYInterappServerCallBackCreateData(
8487
NSMutableData* responseData ;
8588
char responseHeaderByte = [delegate responseHeaderByte] ;
8689
NSData* responsePayload = [delegate responsePayload] ;
90+
[delegate release];
8791
if (responseHeaderByte || responsePayload) {
8892
responseData = [[NSMutableData alloc] init] ;
8993
if (responseHeaderByte != 0) {

0 commit comments

Comments
 (0)