summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kinney <michaelakinney@comcast.net>2021-02-13 13:51:47 -0500
committerMichael Kinney <michaelakinney@comcast.net>2021-02-13 13:51:47 -0500
commit531ba7cf886b883d0cd10c8bfc2dfab3c9ae4ba3 (patch)
treef80dfc1c85ca24416bdce9723f32e835a4a82897
parent9d8931eccf781ce7bf4ce91db332bf9b7796b720 (diff)
downloadsdl_ios-531ba7cf886b883d0cd10c8bfc2dfab3c9ae4ba3.tar.gz
stop run loop before closing streams
-rw-r--r--SmartDeviceLink/private/SDLIAPSession.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/SmartDeviceLink/private/SDLIAPSession.m b/SmartDeviceLink/private/SDLIAPSession.m
index ff12b7e22..d9eda7d1c 100644
--- a/SmartDeviceLink/private/SDLIAPSession.m
+++ b/SmartDeviceLink/private/SDLIAPSession.m
@@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void) dealloc {
- if (self.eaSession != nil) {
+ if (self.eaSession != nil && self.sessionThread != nil) {
[self performSelector:@selector(peformCloseSession) onThread:self.sessionThread withObject:nil waitUntilDone:YES];
}
}
@@ -126,10 +126,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void) peformCloseSession {
SDLLogD(@"Closing EASession streams");
if (self.eaSession != nil) {
+ [self stopStreamRunLoop];
[self close: self.eaSession.inputStream];
[self close: self.eaSession.outputStream];
self.eaSession = nil;
- [self stopStreamRunLoop];
} else {
SDLLogD(@"Failed to close streams because EASession is already nil");
}