Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -21,11 +21,13 @@ #import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "OFMacros.h" #import -#ifndef __objc_INCLUDE_GNU +#ifdef __objc_INCLUDE_GNU +#import +#else #import #endif struct pre_ivar { void **memchunks; @@ -137,10 +139,17 @@ if (oldimp == (IMP)0 || newimp == (IMP)0) @throw [OFInvalidArgumentException newWithClass: self andSelector: _cmd]; method->method_imp = newimp; + + /* Update the dtable if necessary */ + if (sarray_get_safe(((Class)self)->dtable, + (sidx)method->method_name->sel_id)) + sarray_at_put_safe(((Class)self)->dtable, + (sidx)method->method_name->sel_id, method->method_imp); + return oldimp; #else Method method = class_getInstanceMethod(self, selector); IMP imp = class_getMethodImplementation(class, selector);