File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,11 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
97
97
uint32_t flags;
98
98
uint16_t config;
99
99
100
+ #if __has_feature(objc_arc_weak)
100
101
__weak id delegate;
102
+ #else
103
+ __unsafe_unretained id delegate;
104
+ #endif
101
105
dispatch_queue_t delegateQueue;
102
106
103
107
int socket4FD;
Original file line number Diff line number Diff line change @@ -1595,7 +1595,7 @@ - (BOOL)doAccept:(int)parentSocketFD
1595
1595
1596
1596
// Create GCDAsyncSocket instance for accepted socket
1597
1597
1598
- GCDAsyncSocket *acceptedSocket = [[GCDAsyncSocket alloc ] initWithDelegate: delegate
1598
+ GCDAsyncSocket *acceptedSocket = [[GCDAsyncSocket alloc ] initWithDelegate: theDelegate
1599
1599
delegateQueue: delegateQueue
1600
1600
socketQueue: childSocketQueue];
1601
1601
@@ -4766,7 +4766,7 @@ - (void)completeCurrentRead
4766
4766
if (delegateQueue && [delegate respondsToSelector: @selector (socket:didReadData:withTag: )])
4767
4767
{
4768
4768
__strong id theDelegate = delegate;
4769
- GCDAsyncReadPacket *theRead = currentRead;
4769
+ GCDAsyncReadPacket *theRead = currentRead; // Ensure currentRead retained since result may not own buffer
4770
4770
4771
4771
dispatch_async (delegateQueue, ^{ @autoreleasepool {
4772
4772
You can’t perform that action at this time.
0 commit comments