Avoid possibility of stream deallocation while sending events.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25004 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2007-04-12 19:39:23 +00:00
parent c554c4045c
commit 4e2e9e93e3
2 changed files with 6 additions and 0 deletions

View file

@ -564,6 +564,7 @@ static void setNonblocking(int fd)
socklen_t len = sizeof(error);
unsigned i = [_modes count];
AUTORELEASE(RETAIN(self));
while (i-- > 0)
{
[_runloop removeStream: self mode: [_modes objectAtIndex: i]];
@ -977,6 +978,7 @@ static void setNonblocking(int fd)
int result;
unsigned i = [_modes count];
AUTORELEASE(RETAIN(self));
while (i-- > 0)
{
[_runloop removeStream: self mode: [_modes objectAtIndex: i]];

View file

@ -876,6 +876,7 @@ static void setNonblocking(SOCKET fd)
- (void) _dispatch
{
AUTORELEASE(RETAIN(self));
/*
* Windows only permits a single event to be associated with a socket
* at any time, but the runloop system only allows an event handle to
@ -1089,6 +1090,8 @@ static void setNonblocking(SOCKET fd)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
CloseHandle(h);
return;
}
}
[self _setLoopID: (void*)h];
@ -1609,6 +1612,7 @@ static void setNonblocking(SOCKET fd)
- (void) _dispatch
{
AUTORELEASE(RETAIN(self));
/*
* Windows only permits a single event to be associated with a socket
* at any time, but the runloop system only allows an event handle to