mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2025-02-12 12:18:20 +00:00
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.
This commit is contained in:
parent
7155f174b7
commit
9d6154041c
7
arc.m
7
arc.m
@ -91,6 +91,13 @@ void objc_autoreleasePoolPop(void *pool)
|
||||
// TODO: Keep a small pool of autorelease pools per thread and allocate
|
||||
// from there.
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user