From 054927cf2179b07524e4deaf9068b06a30a6eb86 Mon Sep 17 00:00:00 2001 From: rfm Date: Mon, 27 Jul 2015 09:50:15 +0000 Subject: [PATCH] Fix crasher if stream is opened more than once. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38841 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/GSStream.m | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d0db4a535..b91a0cb53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-07-27 Richard Frith-Macdonald + + * Source/GSStream.m: Fix failure to unschedule from run loop if a + stream is opened more than once. + 2015-07-24 Richard Frith-Macdonald * Headers/GNUstepBase/GSIMap.h: add GSI_MAP_TABLE_S diff --git a/Source/GSStream.m b/Source/GSStream.m index 9cd34c97b..6b7587ca4 100644 --- a/Source/GSStream.m +++ b/Source/GSStream.m @@ -125,10 +125,14 @@ static RunLoopEventType typeForStream(NSStream *aStream) - (void) removeStream: (NSStream*)aStream mode: (NSString*)mode { + /* We may have added the stream more than once (eg if the stream -open + * method was called more than once, so we need to remove all event + * registrations. + */ [self removeEvent: [aStream _loopID] type: typeForStream(aStream) forMode: mode - all: NO]; + all: YES]; } @end