mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Remove stream from handler upon deallocation, to avlid handler sending messages to deallocated stream.
This commit is contained in:
parent
fa27dfeed4
commit
dca9b65313
1 changed files with 14 additions and 0 deletions
|
@ -288,6 +288,7 @@ GSPrivateSockaddrSetup(NSString *machine, uint16_t port,
|
|||
- (BOOL) handshake; /* A handshake/hello is in progress. */
|
||||
- (void) hello; /* Start up the session handshake. */
|
||||
- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len;
|
||||
- (void) remove: (NSStream*)stream; /* Stream no longer available */
|
||||
- (void) stream: (NSStream*)stream handleEvent: (NSStreamEvent)event;
|
||||
- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len;
|
||||
@end
|
||||
|
@ -346,6 +347,18 @@ GSPrivateSockaddrSetup(NSString *machine, uint16_t port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
- (void) remove: (NSStream*)stream
|
||||
{
|
||||
if ((id)stream == (id)istream)
|
||||
{
|
||||
istream = nil;
|
||||
}
|
||||
if ((id)stream == (id)ostream)
|
||||
{
|
||||
ostream = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) stream: (NSStream*)stream handleEvent: (NSStreamEvent)event
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -1505,6 +1518,7 @@ setNonBlocking(SOCKET fd)
|
|||
}
|
||||
[_sibling _setSibling: nil];
|
||||
_sibling = nil;
|
||||
[_handler remove: self];
|
||||
DESTROY(_handler);
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue