Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.05k stars 1.37k forks source link

UITableView.delegate 开启了 qmui_multipleDelegatesEnabled 后在 dealloc 时可能引发 crash #1411

Closed MoLice closed 1 year ago

MoLice commented 2 years ago

Bug 表现 tableViewController 在 dealloc 后可能出现 UITableView dataSource returned a nil cell for row at index path 的异常。

其他信息

MoLice commented 2 years ago
image

开启 qmui_multipleDelegatesEnabled 的对象,即便执行了 obj.delegate = nil,实际上并不会真的把 delegate 置空,而是把 QMUIMultipleDelegates 容器里的对象都清空,但 obj.delegate 依然是指向 QMUIMultipleDelegates 对象。这就会导致当 - [UITableViewController dealloc] 时把 tableView.delegate = nil 后,由于某些原因 tableView 又试图去访问 delegate,就会因为 delegates 被清空,导致 tableView:cellForRowAtIndexPath: 返回一个 nil 的结果,命中系统的 assert。

MoLice commented 1 year ago

已发布 4.5.0 修复该问题。