mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-23 12:19:44 +00:00
Cleaner version of the last fix.
This commit is contained in:
parent
fb2e6756f6
commit
ffa7dbad8d
@ -244,7 +244,10 @@ PRIVATE BOOL objc_resolve_class(Class cls)
|
||||
// Fix up the ivar offsets
|
||||
objc_compute_ivar_offsets(cls);
|
||||
// Send the +load message, if required
|
||||
if (!objc_test_class_flag(cls, objc_class_flag_user_created))
|
||||
{
|
||||
objc_send_load_message(cls);
|
||||
}
|
||||
if (_objc_load_callback)
|
||||
{
|
||||
_objc_load_callback(cls, 0);
|
||||
@ -486,7 +489,7 @@ Class class_getSuperclass(Class cls)
|
||||
if (Nil == cls) { return Nil; }
|
||||
if (!objc_test_class_flag(cls, objc_class_flag_resolved))
|
||||
{
|
||||
return objc_getClass((const char*)cls->super_class);
|
||||
objc_resolve_class(cls);
|
||||
}
|
||||
return cls->super_class;
|
||||
}
|
||||
|
11
runtime.c
11
runtime.c
@ -700,17 +700,9 @@ Class objc_allocateClassPair(Class superclass, const char *name, size_t extraByt
|
||||
// in objc_resolve_class().
|
||||
// If the superclass is not yet resolved, then we need to look it up
|
||||
// via the class table.
|
||||
if (!objc_test_class_flag(superclass, objc_class_flag_resolved))
|
||||
{
|
||||
metaClass->super_class = (Class)objc_getClass((char*)superclass->super_class);
|
||||
metaClass->isa = (Class)metaClass->super_class->isa->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
metaClass->isa = (Class)superclass->isa->isa->name;
|
||||
metaClass->super_class = superclass->isa;
|
||||
}
|
||||
}
|
||||
metaClass->name = strdup(name);
|
||||
metaClass->info = objc_class_flag_meta | objc_class_flag_user_created |
|
||||
objc_class_flag_new_abi;
|
||||
@ -788,9 +780,12 @@ const char *object_getClassName(id obj)
|
||||
return class_getName(object_getClass(obj));
|
||||
}
|
||||
|
||||
PRIVATE void objc_resolve_class(Class);
|
||||
|
||||
void objc_registerClassPair(Class cls)
|
||||
{
|
||||
LOCK_RUNTIME_FOR_SCOPE();
|
||||
class_table_insert(cls);
|
||||
objc_resolve_class(cls);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user