diff --git a/ChangeLog b/ChangeLog index d00588c86..d24210a8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-19 Richard Frith-Macdonald + + * Source/NSAutoreleasePool.m: Use get_imp() to fetch the + implementation of the release method. + 2008-03-19 Richard Frith-Macdonald * Source/DocMakefile: include GNUstep.h diff --git a/Source/NSAutoreleasePool.m b/Source/NSAutoreleasePool.m index b5bbc9f67..d509d16cd 100644 --- a/Source/NSAutoreleasePool.m +++ b/Source/NSAutoreleasePool.m @@ -406,31 +406,16 @@ static IMP initImp; hash = (((unsigned)(uintptr_t)c) >> 3) & 0x0f; if (classes[hash] != c) { - IMP imp; - -#if 1 - if (GSObjCIsInstance(anObject)) - { - /* We call instanceMethodForSelector: on the class - * rather than methodForSelector: because EOFault - * implements the former but not the latter. - */ - imp = [c instanceMethodForSelector: releaseSel]; - } - else - { - imp = [c methodForSelector: releaseSel]; - } - if (imp == 0) - { - [NSException raise: NSInternalInconsistencyException - format: @"nul release for object in autorelease pool"]; - } -#else - imp = get_imp(anObject, @selector(release)); -#endif + /* If anObject was an instance, c is it's class. + * If anObject was a class, c is its metaclass. + * Either way, get_imp() should get the appropriate pointer. + * If anObject is a proxy to something, + * the +instanceMethodForSelector: and -methodForSelector: + * methods may not exist, but get_imp() will return the + * address of the forwarding method if necessary. + */ + imps[hash] = get_imp(c, @selector(release)); classes[hash] = c; - imps[hash] = imp; } (imps[hash])(anObject, releaseSel); }