ObjCExport: prohibit Kotlin exceptions leaking through native code back
If a Kotlin exceptions is thrown out of a native code in ObjCExport (when calling Swift/Obj-C method overriding Kotlin method, or calling Swift/Obj-C block as Kotlin function type), treat this exception as fatal and terminate the process. This could happen if the Kotlin exception leaked from Kotlin to native code before. In other words, when calling Kotlin -> Swift/Obj-C -> Kotlin, if Kotlin exception passes from the last to the first part, terminate. ^KT-50830
This commit is contained in:
committed by
Space
parent
f7a1fa86a9
commit
776154881b
@@ -504,17 +504,7 @@ fun runUnitBlock(block: () -> Unit): Boolean {
|
||||
|
||||
fun asUnitBlock(block: () -> Any?): () -> Unit = { block() }
|
||||
|
||||
fun runNothingBlock(block: () -> Nothing) = try {
|
||||
block()
|
||||
false
|
||||
} catch (e: Throwable) {
|
||||
true
|
||||
}
|
||||
|
||||
fun asNothingBlock(block: () -> Any?): () -> Nothing = {
|
||||
block()
|
||||
TODO()
|
||||
}
|
||||
fun runNothingBlock(block: () -> Nothing) { (block as () -> Any?)() }
|
||||
|
||||
fun getNullBlock(): (() -> Unit)? = null
|
||||
fun isBlockNull(block: (() -> Unit)?): Boolean = block == null
|
||||
|
||||
Reference in New Issue
Block a user