microsoft / WinObjC

Objective-C for Windows
MIT License
6.24k stars 810 forks source link

[libobjc2] method_setImplementation does not work on resolved metaclasses #1639

Open DHowett-MSFT opened 7 years ago

DHowett-MSFT commented 7 years ago

When you use method_setImplementation(Method, IMP) on a method retrieved from a metaclass (lit.: a class method), and that metaclass is fully resolved, its dtable will not be updated to point to the new IMP.

This is due to a bug in objc_updateDtableForClassContainingMethod. It iterates over every class known to the runtime and updates the dtable of the first class containing that selector (!!).

DHowett-MSFT commented 7 years ago

Tracked in gnustep/libobjc2#32.