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

QMUISearchController 在 active 时如果被强制切走则可能出现内存泄漏 #1541

Open
MoLice opened this issue Feb 4, 2024 · 0 comments
Labels

Comments

@MoLice
Copy link
Collaborator

MoLice commented Feb 4, 2024

重现操作

  1. 某个处于 UINavigationController 里的 VC 里使用 QMUISearchController
  2. 在 VC 里点搜索框进入搜索。
  3. 此时对 VC 调用 [self.navigationController popToRootViewControllerAnimated:YES] 强制切走界面。
  4. 会发现 VC 和 VC 里的 QMUISearchController 均未被析构。

同样地,如果把上述的3换成 UIApplication.sharedApplication.delegate.window.rootViewController = UIViewController.new 也依然会导致4的现象。

但如果 VC 不处于 UINavigationController 里则没这个问题。

解决方式

应该是系统的 bug,但暂时没去深究,目前的解决方式是 hook - [UIViewController didMoveToParentViewController:] 发现离开界面时正在搜索状态则手动降下搜索。

@MoLice MoLice added the bug label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant