Skip to content

Commit 9a95178

Browse files
committed
fix: ANR caused by a deadlock
1 parent 03d40ec commit 9a95178

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

common/src/commonMain/kotlin/com/blockstream/common/models/abstract/AbstractScannerViewModel.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ abstract class AbstractScannerViewModel(val isDecodeContinuous: Boolean = false,
9191
}
9292
}
9393
} else {
94-
barcodeScannerResult(ScanResult(scannedText))
94+
// launch a new coroutine to avoid blocking the main thread
95+
viewModelScope.coroutineScope.launch(context = logException(countly)) {
96+
barcodeScannerResult(ScanResult(scannedText))
97+
}
9598
}
9699
}
97100
}

0 commit comments

Comments
 (0)