fix: 修复 noDataWatchdogTask 潜在的内存泄漏问题
在 Runnable 中添加生命周期检查,防止 Activity 销毁后任务继续执行。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -273,6 +273,9 @@ class HomeActivity : BaseActivity() {
|
||||
*/
|
||||
private val noDataWatchdogTask = object : Runnable {
|
||||
override fun run() {
|
||||
// 生命周期检查,防止 Activity 销毁后继续执行
|
||||
if (isFinishing || isDestroyed) return
|
||||
|
||||
val elapsed = System.currentTimeMillis() - lastDataReceivedTime
|
||||
if (elapsed >= 5 * 60 * 1000L) {
|
||||
if (noDataWarningDialog == null) {
|
||||
|
||||
Reference in New Issue
Block a user