fix: Fix AWT thread crash that happens because the compose state gets updated from another thread

This commit is contained in:
Artem Chepurnoy 2024-01-07 23:07:32 +02:00
parent c8e2fab4c3
commit d06292c071
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import com.artemchep.keyguard.platform.get
import com.artemchep.keyguard.platform.leBundleOf
import dev.icerock.moko.resources.StringResource
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.Flow
@ -63,7 +64,7 @@ class RememberStateFlowScopeImpl(
sink: MutableStateFlow<T>,
) {
private val collectScope by lazy {
scope + Job()
scope + Dispatchers.Main + Job()
}
val mutableState by lazy {