Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

viewdisappear后调用组件的方法容易crash #499

Closed
jqoo opened this issue Sep 18, 2019 · 2 comments
Closed

viewdisappear后调用组件的方法容易crash #499

jqoo opened this issue Sep 18, 2019 · 2 comments

Comments

@jqoo
Copy link

jqoo commented Sep 18, 2019

`

  • (SEL)_methodWithComponetName:(NSString *)name withMethod:(NSString *)method isSync:(BOOL *)isSync
    {
    WXAssert(name && method, @"Fail to find selector with module name and method, please check if the parameters are correct !");
    //...
    }
    闪退在了这里,原因是在页面pop时,发出了disappear,然后销毁了页面里的实例,但页面里disappear事件的回调方法里,调用组件的方法时,self.instance依然是非空,根据ref找不到组件:
  • (void)invoke
    {
    WXPerformBlockOnComponentThread(^{
    WXComponent *component = [self.instance componentForRef:_componentRef];
    if (!component) {
    WXLogError(@"component not found for ref:%@, type:%@", _componentRef, _componentName);
    }
    //...
    }
    `
@YorkShen
Copy link
Contributor

You just find the answer by yourself, great work.

You could give us a PR if you can, I am very happy to talk with you implemenation detail or review you PR in mailing list

@YorkShen
Copy link
Contributor

YorkShen commented Oct 31, 2019

Duplicated with apache/incubator-weex#2922

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants