From 2a5ba9f18a37302974909eb5e8847aba8d66e0dc Mon Sep 17 00:00:00 2001 From: theraven Date: Wed, 6 Jan 2010 18:11:39 +0000 Subject: [PATCH] Fixed class_get_super_class() so that it actually works and simplified class_getSuperclass() to call it directly. This fixes numerous other corner cases, for example you can now throw a constant string as an exception and have it work correctly even if no constant string objects have been sent messages. Hopefully this will fix a few other Heisenbugs and reduce the strength of the Mottola Effect. --- objc/objc-api.h | 11 ++++++++++- runtime.c | 4 ---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/objc/objc-api.h b/objc/objc-api.h index 0a9b223..f68ae2d 100644 --- a/objc/objc-api.h +++ b/objc/objc-api.h @@ -550,7 +550,16 @@ class_get_meta_class(Class _class) static inline Class class_get_super_class(Class _class) { - return CLS_ISCLASS(_class)?_class->super_class:Nil; + void __objc_resolve_class_links(void); + if CLS_ISCLASS(_class) + { + if (!CLS_ISRESOLV(_class)) + { + __objc_resolve_class_links(); + } + return _class->super_class; + } + return Nil; } static inline int diff --git a/runtime.c b/runtime.c index e2b13eb..3ca148c 100644 --- a/runtime.c +++ b/runtime.c @@ -397,10 +397,6 @@ const char * class_getName(Class cls) void __objc_resolve_class_links(void); Class class_getSuperclass(Class cls) { - if (!CLS_ISRESOLV(cls)) - { - __objc_resolve_class_links(); - } return class_get_super_class(cls); }