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

21
arc.m

@ -219,15 +219,18 @@ static inline void initAutorelease(void)
} }
else else
{ {
[AutoreleasePool class]; useARCAutoreleasePool = (0 != class_getInstanceMethod(AutoreleasePool,
useARCAutoreleasePool = class_respondsToSelector(AutoreleasePool, SELECTOR(_ARCCompatibleAutoreleasePool)));
SELECTOR(_ARCCompatibleAutoreleasePool)); if (!useARCAutoreleasePool)
NewAutoreleasePool = class_getMethodImplementation(object_getClass(AutoreleasePool), {
SELECTOR(new)); [AutoreleasePool class];
DeleteAutoreleasePool = class_getMethodImplementation(AutoreleasePool, NewAutoreleasePool = class_getMethodImplementation(object_getClass(AutoreleasePool),
SELECTOR(release)); SELECTOR(new));
AutoreleaseAdd = class_getMethodImplementation(object_getClass(AutoreleasePool), DeleteAutoreleasePool = class_getMethodImplementation(AutoreleasePool,
SELECTOR(addObject:)); SELECTOR(release));
AutoreleaseAdd = class_getMethodImplementation(object_getClass(AutoreleasePool),
SELECTOR(addObject:));
}
} }
} }
} }

Loading…
Cancel
Save