Make sure that autoreleased returned objects are destroyed when the autorelease

pool is destroyed.  They were previously being destroyed on thread termination,
this ensures that their lifespan is predictable.
main
theraven 15 years ago
parent 7155f174b7
commit 9d6154041c

@ -91,6 +91,13 @@ void objc_autoreleasePoolPop(void *pool)
// TODO: Keep a small pool of autorelease pools per thread and allocate // TODO: Keep a small pool of autorelease pools per thread and allocate
// from there. // from there.
DeleteAutoreleasePool(pool, SELECTOR(release)); DeleteAutoreleasePool(pool, SELECTOR(release));
#ifndef NO_PTHREADS
// Ensure that autoreleased return values are destroyed at the correct
// moment.
id tmp = pthread_getspecific(ReturnRetained);
objc_release(tmp);
pthread_setspecific(ReturnRetained, NULL);
#endif
} }
id objc_autorelease(id obj) id objc_autorelease(id obj)

Loading…
Cancel
Save