Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用super后死循环 #856

Open
gopep9 opened this issue Sep 10, 2019 · 0 comments
Open

调用super后死循环 #856

gopep9 opened this issue Sep 10, 2019 · 0 comments

Comments

@gopep9
Copy link

gopep9 commented Sep 10, 2019

假如对某个对象调用其祖父类实现的函数,会在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]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant