From b5e21d2c9634124d1ec49faf5df9be803f278490 Mon Sep 17 00:00:00 2001 From: Gary Hughes Date: Mon, 13 May 2024 20:51:28 +1000 Subject: [PATCH] Invalidate the socket before releasing. --- SPLPing/SPLPing.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SPLPing/SPLPing.m b/SPLPing/SPLPing.m index 03df314..67cfc28 100644 --- a/SPLPing/SPLPing.m +++ b/SPLPing/SPLPing.m @@ -171,8 +171,13 @@ - (void)dealloc { [self stop]; - CFRunLoopSourceInvalidate(_socketSource); CFRelease(_socketSource); _socketSource = nil; - CFRelease(_socket); _socket = nil; + CFRunLoopSourceInvalidate(_socketSource); + CFRelease(_socketSource); + _socketSource = nil; + + CFSocketInvalidate(_socket); + CFRelease(_socket); + _socket = nil; } #pragma mark - Instance methods