diff --git a/libraries/mogo-hardware-devices/src/main/java/com/mogo/support/device/led/BaseLedUIViewModel.kt b/libraries/mogo-hardware-devices/src/main/java/com/mogo/support/device/led/BaseLedUIViewModel.kt index 6d109a01dd..5d9db985e7 100644 --- a/libraries/mogo-hardware-devices/src/main/java/com/mogo/support/device/led/BaseLedUIViewModel.kt +++ b/libraries/mogo-hardware-devices/src/main/java/com/mogo/support/device/led/BaseLedUIViewModel.kt @@ -248,12 +248,14 @@ open class BaseLedUIViewModel(protected val writeChainLogListener: IWriteChainLo * 从等待队列中删除目标类型数据 */ private fun removeRestoreLedUI(msg: LedUI) { - val toRemove = restoreLedUIQueue.filter { - it.javaClass == msg.javaClass || - (it is LedUICountDown && it.countDownSeconds > 0 - && it.absCountDownTimestamp <= System.currentTimeMillis()) + synchronized(restoreLedUIQueue) { + val queueCopy = restoreLedUIQueue.toList() + val toRemove = queueCopy.filter { + it.javaClass == msg.javaClass || + (it is LedUICountDown && it.countDownSeconds > 0 + && it.absCountDownTimestamp <= System.currentTimeMillis()) + } + restoreLedUIQueue.removeAll(toRemove.toSet()) } - restoreLedUIQueue.removeAll(toRemove.toSet()) } - } \ No newline at end of file