only access array if port responds to selector, or it is not initialized

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31276 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2010-09-09 21:22:31 +00:00
parent 46076fe15b
commit 703219c464
2 changed files with 14 additions and 10 deletions

View file

@ -1,3 +1,7 @@
2010-09-10 Riccardo Mottola
* Source/unix/GSRunLoopCtxt.m: only access array if port responds to selector, or it is not initialized.
2010-09-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: Fix retain/release bugs spotted by clang.

View file

@ -384,19 +384,19 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
int port_fd_array[port_fd_count];
if ([port respondsToSelector:
@selector(getFds:count:)])
@selector(getFds:count:)])
{
[port getFds: port_fd_array
count: &port_fd_count];
}
NSDebugMLLog(@"NSRunLoop",
@"listening to %d port handles\n", port_fd_count);
while (port_fd_count--)
{
fd = port_fd_array[port_fd_count];
setPollfd(fd, POLLIN, self);
NSMapInsert(_rfdMap,
(void*)(intptr_t)port_fd_array[port_fd_count], info);
NSDebugMLLog(@"NSRunLoop",
@"listening to %d port handles\n", port_fd_count);
while (port_fd_count--)
{
fd = port_fd_array[port_fd_count];
setPollfd(fd, POLLIN, self);
NSMapInsert(_rfdMap,
(void*)(intptr_t)port_fd_array[port_fd_count], info);
}
}
}
break;