Skip to content
Browse files

Avoid infinite recursion in UITextInputTraits_valueForKey(). Fixes #22

  • Loading branch information...
1 parent 08cc934 commit aac1a8a82a9561aa1cef7b954183ebd096ccc857 @0xced committed Jul 26, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 DCIntrospect/DCIntrospect.m
View
4 DCIntrospect/DCIntrospect.m
@@ -103,7 +103,9 @@ + (void)workaroundUITextInputTraitsPropertiesBug
{
IMP originalValueForKey = class_replaceMethod(class, @selector(valueForKey:), (IMP)UITextInputTraits_valueForKey, valueForKeyTypeEncoding);
if (!originalValueForKey)
- originalValueForKey = class_getMethodImplementation([class superclass], @selector(valueForKey:));
+ originalValueForKey = [objc_getAssociatedObject([class superclass], originalValueForKeyIMPKey) pointerValue];
+ if (!originalValueForKey)
+ originalValueForKey = class_getMethodImplementation([class superclass], @selector(valueForKey:));
objc_setAssociatedObject(class, originalValueForKeyIMPKey, [NSValue valueWithPointer:originalValueForKey], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

0 comments on commit aac1a8a

Please sign in to comment.
Something went wrong with that request. Please try again.