Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -313,10 +313,13 @@ + (void)terminateWithObject: (id)object { OFThread *thread = of_tlskey_get(threadSelfKey); + if (thread == mainThread) + @throw [OFInvalidArgumentException exception]; + OF_ENSURE(thread != nil); thread->_returnValue = [object retain]; longjmp(thread->_exitEnv, 1);