Differences From Artifact [efb4532301]:
- File
src/OFObject.m
— part of check-in
[c70fd7d7f3]
at
2016-10-08 15:57:45
on branch trunk
— Never override CoreFoundations's forward handler
If an application links ObjFW and (Core)Foundation, overriding
CoreFoundation's forward handler breaks things.Before this commit, this only worked depending on the load order: If
ObjFW was loaded first, everything was fine, as CoreFoundation would
just override ObjFW's forward handler. However, if CoreFoundation would
be loaded first, ObjFW would override CoreFoundation's forward handler
and break CoreFoundation. (user: js, size: 25049) [annotate] [blame] [check-ins using]
To Artifact [f0a708441f]:
- File
src/OFObject.m
— part of check-in
[ccd504e68d]
at
2016-10-15 20:47:45
on branch trunk
— Use NSFoundationVersionNumber to detect Foundation
This is more reliable than checking for CFRetain to see if
CoreFoundation is linked, as CFRetain is always available, even when not
linked against CoreFoundation explicitly. (user: js, size: 25091) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
56 57 58 59 60 61 62 | #if defined(OF_HAVE_ATOMIC_OPS) # import "atomic.h" #elif defined(OF_HAVE_THREADS) # import "threading.h" #endif #ifdef OF_APPLE_RUNTIME | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #if defined(OF_HAVE_ATOMIC_OPS) # import "atomic.h" #elif defined(OF_HAVE_THREADS) # import "threading.h" #endif #ifdef OF_APPLE_RUNTIME extern double *NSFoundationVersionNumber __attribute__((__weak__)); #endif #if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR) extern id of_forward(id, SEL, ...); extern struct stret of_forward_stret(id, SEL, ...); #else # define of_forward of_method_not_found |
︙ | ︙ | |||
216 217 218 219 220 221 222 | { #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) objc_setUncaughtExceptionHandler(uncaughtExceptionHandler); #endif #if defined(OF_APPLE_RUNTIME) /* | | | | > | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | { #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) objc_setUncaughtExceptionHandler(uncaughtExceptionHandler); #endif #if defined(OF_APPLE_RUNTIME) /* * If the NSFoundationVersionNumber symbol is defined, we are linked * against Foundation. Since CoreFoundation sets its own forward * handler on load, we should not set ours, as this will break * Foundation. * * Unfortunately, there is no way to check if a forward handler has * already been set, so this is the best we can do. */ if (&NSFoundationVersionNumber == NULL) objc_setForwardHandler((void*)&of_forward, (void*)&of_forward_stret); #else objc_setForwardHandler((IMP)&of_forward, (IMP)&of_forward_stret); #endif objc_setEnumerationMutationHandler(enumerationMutationHandler); |
︙ | ︙ |