Work around GNUstep's inability to initialise NSAutoreleasePool without

performing recursive autoreleases (introduced in r37479).
Fixes crashing of C++ static constructors.
main
theraven 12 years ago
parent 42948106cd
commit 76a88312dd

@ -252,6 +252,7 @@ set_target_properties(objc PROPERTIES
LINK_FLAGS "${objc_LINK_FLAGS}"
)
set_property(TARGET PROPERTY NO_SONAME true)
set(BUILD_STATIC_LIBOBJC false CACHE BOOL
"Build the static version of libobjc")
@ -360,6 +361,7 @@ configure_file(
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
set(TESTS TRUE CACHE BOOL
"Enable building the tests")

@ -218,10 +218,12 @@ static inline void initAutorelease(void)
useARCAutoreleasePool = YES;
}
else
{
useARCAutoreleasePool = (0 != class_getInstanceMethod(AutoreleasePool,
SELECTOR(_ARCCompatibleAutoreleasePool)));
if (!useARCAutoreleasePool)
{
[AutoreleasePool class];
useARCAutoreleasePool = class_respondsToSelector(AutoreleasePool,
SELECTOR(_ARCCompatibleAutoreleasePool));
NewAutoreleasePool = class_getMethodImplementation(object_getClass(AutoreleasePool),
SELECTOR(new));
DeleteAutoreleasePool = class_getMethodImplementation(AutoreleasePool,
@ -230,6 +232,7 @@ static inline void initAutorelease(void)
SELECTOR(addObject:));
}
}
}
}
static inline id autorelease(id obj)

Loading…
Cancel
Save