From 4782d743ed4e48ac5a6904caa2902e636a96366e Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Tue, 25 Jun 2013 09:05:00 +0000 Subject: [PATCH] fix segfault when no threads are configuredb ... should use main thread. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/performance/trunk@36752 72102866-910b-0410-8b05-ffd578937521 --- GSIOThreadPool.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GSIOThreadPool.m b/GSIOThreadPool.m index 03e661b..1fbfd8d 100644 --- a/GSIOThreadPool.m +++ b/GSIOThreadPool.m @@ -145,8 +145,13 @@ best(NSMutableArray *a) GSIOThread *t; [poolLock lock]; + if (0 == maxThreads) + { + [poolLock unlock]; + return [NSThread mainThread]; + } t = best(threads); - if (t->count > 0 && [threads count] < maxThreads) + if (nil == t || (t->count > 0 && [threads count] < maxThreads)) { t = [GSIOThread new]; [threads addObject: t];