Add hidden class -dealloc method as -finalize as well.

main
theraven 15 years ago
parent 9015795dde
commit a4decfa4e3

@ -231,6 +231,8 @@ static inline Class initHiddenClassForObject(id obj)
SELECTOR(dealloc))); SELECTOR(dealloc)));
class_addMethod(hiddenClass, SELECTOR(dealloc), (IMP)deallocHiddenClass, class_addMethod(hiddenClass, SELECTOR(dealloc), (IMP)deallocHiddenClass,
types); types);
class_addMethod(hiddenClass, SELECTOR(finalize), (IMP)deallocHiddenClass,
types);
obj->isa = hiddenClass; obj->isa = hiddenClass;
} }
return hiddenClass; return hiddenClass;
@ -243,7 +245,7 @@ static void deallocHiddenClass(id obj, SEL _cmd)
// Call the real -dealloc method (this ordering is required in case the // Call the real -dealloc method (this ordering is required in case the
// user does @synchronized(self) in -dealloc) // user does @synchronized(self) in -dealloc)
struct objc_super super = {obj, realClass}; struct objc_super super = {obj, realClass};
objc_msg_lookup_super(&super, SELECTOR(dealloc))(obj, SELECTOR(dealloc)); objc_msg_lookup_super(&super, _cmd)(obj, _cmd);
// After calling [super dealloc], the object will no longer exist. // After calling [super dealloc], the object will no longer exist.
// Free the hidden // Free the hidden
struct reference_list *list = object_getIndexedIvars(hiddenClass); struct reference_list *list = object_getIndexedIvars(hiddenClass);

Loading…
Cancel
Save