Piasy
07/24/2022, 6:39 AMregex.find
, and the stack has over 700 frames (please check the attached screenshot). It always crash, both on my iPhone11 real device and iPhone11 simulator.
class Greeting {
@OptIn(ExperimentalCoroutinesApi::class) fun greeting(): String {
val scope = CoroutineScope(newSingleThreadContext("test"))
scope.launch {
val regex = """(.*?mainpic.*?src=")""".toRegex()
val res = regex.find(TEST_HTML.replace("\n", ""))
println("regex res: $res ${res?.groups?.size}")
}
return "Hello!"
}
private val TEST_HTML = "a specific html string"
}
It won’t crash if I change the code above a little bit:
1. not launch the coroutine in scope with newSingleThreadContext
;
2. change the regex
to other value;
3. change the TEST_HTML
to other value (please find the full value of it in attached project, which is created using Android studio project wizard, and add code above);Miroslav Sobotka
07/27/2022, 11:05 PM