Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -270,10 +270,17 @@ { if (running == OF_THREAD_RUNNING) @throw [OFThreadStillRunningException newWithClass: isa thread: self]; + /* + * We should not be running anymore, but call detach in order to free + * the resources. + */ + if (running == OF_THREAD_WAITING_FOR_JOIN) + of_thread_detach(thread); + [object release]; [retval release]; [super dealloc]; } Index: src/threading.h ================================================================== --- src/threading.h +++ src/threading.h @@ -88,10 +88,21 @@ CloseHandle(thread); return YES; #endif } + +static OF_INLINE BOOL +of_thread_detach(of_thread_t thread) +{ +#if defined(OF_HAVE_PTHREADS) + return !pthread_detach(thread); +#elif defined(_WIN32) + /* FIXME */ + return YES; +#endif +} static OF_INLINE void of_thread_exit() { #if defined(OF_HAVE_PTHREADS)