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

fix: fix crash when reload page. #1102

Merged
merged 2 commits into from
Jan 17, 2022
Merged

fix: fix crash when reload page. #1102

merged 2 commits into from
Jan 17, 2022

Conversation

andycall
Copy link
Member

@andycall andycall commented Jan 14, 2022

Fixed #1100

https://github.com/openkraken/kraken/pull/1081/files#diff-a21b93f4669388bbfdaff8b8f333f82a26d15b2b7212b990314296c47d1fe93eR111 设置为 nullptr 会导致销毁页面过程中,调用 flushUICommand() 所依赖的 getUICommandItems() 返回为 nullptr, 从而使得 JS 侧 eventTarget 已经被销毁,而 Dart 没有收到指令无法销毁,进行双方不一致导致 crash。

answershuto
answershuto previously approved these changes Jan 14, 2022
// Should clear previous page cached ui commands
clearUICommand(_view.contextId);

// Wait for next microtask to make sure C++ native Elements are GC collected.
Completer completer = Completer();
Future.microtask(() {
disposePage(_view.contextId);
_module.dispose();
_view.dispose();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个为啥移过来了

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前就是在 microtask 里面销毁 view。后来被 #940 改坏了。导致 reload 无法释放 Bridge 的内存。

@wssgcg1213 wssgcg1213 merged commit d7b4810 into main Jan 17, 2022
@wssgcg1213 wssgcg1213 deleted the fix/reload_crash branch January 17, 2022 04:27
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

Successfully merging this pull request may close these issues.

reload报错
3 participants