From bac39eafec97af11e21eef749264e2f26becc421 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Mon, 28 Jul 2014 09:29:55 +0000 Subject: [PATCH] attempt to fix possible problem with early release of ostream git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38017 72102866-910b-0410-8b05-ffd578937521 --- Source/GSSocketStream.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/GSSocketStream.m b/Source/GSSocketStream.m index 41be6d15b..64c334f00 100644 --- a/Source/GSSocketStream.m +++ b/Source/GSSocketStream.m @@ -647,6 +647,12 @@ static NSArray *keys = nil; { NSDebugMLLog(@"NSStream", @"GSTLSHandler completed on %p", stream); + + /* Make sure that, if ostream gets released as a result of + * the event we send to istream, it doesn't get deallocated + * and cause a crash when we try to send to it. + */ + AUTORELEASE(RETAIN(ostream)); if ([istream streamStatus] == NSStreamStatusOpen) { [istream _resetEvents: NSStreamEventOpenCompleted];