Skip to content

调用super后死循环 #856

@gopep9

Description

@gopep9

假如对某个对象调用其祖父类实现的函数,会在JPForwardInvocation和JPExecuteORIGForwardInvocation之间无限死循环
猜测_currInvokeSuperClsName是用于解决这个问题的,不过没有生效,应该是键值在各个函数中对不上
解决方法是把
JPForwardInvocation函数中的
_currInvokeSuperClsName[selectorName]
替换为
_currInvokeSuperClsName[JPSelectorName]
并且把callSelector中的

    if (superClassName) _currInvokeSuperClsName[selectorName] = superClassName;
    [invocation invoke];
    if (superClassName) [_currInvokeSuperClsName removeObjectForKey:selectorName];

替换为

   if(superClassName) _currInvokeSuperClsName[[NSString stringWithFormat:@"_JPSUPER_%@", selectorName]] = superClassName;
   [invocation invoke];
   if(superClassName) [_currInvokeSuperClsName removeObjectForKey:[NSString stringWithFormat:@"_JPSUPER_%@", selectorName]];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions