Does anybody understand why this crash on X64/ARM64 ?
open class IOSSerialDispatchQueue(identifier: String) : DispatchQueue {
private val serialQueue = dispatch_queue_create(
"com.mirego.trikot.foundation.serial_dispatch_queue.$identifier",
dispatch_queue_serial_t()
)
override fun isSerial() = true
override fun dispatch(block: DispatchBlock) {
freeze(block)
dispatch_async(serialQueue, freeze {
runQueueTask(block)
})
}
private fun runQueueTask(block: DispatchBlock) {
block()
}
}
The crash happens in class initialization at line
dispatch_queue_create("...", dispatch_queue_serial_t())
. I can reproduce with the following swift code
let _ = IOSSerialDispatchQueue(identifier: "None")
in my AppDelegate.swift file . The crash is
EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
(Kotlin 1.4)