[K/N] Catch exceptions in CAdapters when caches enabled (KT-47828 fixed)
This commit is contained in:
@@ -45,6 +45,16 @@ void ThrowException(KRef exception) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void HandleCurrentExceptionForCInterop() {
|
||||
try {
|
||||
std::rethrow_exception(std::current_exception());
|
||||
} catch (ExceptionObjHolder& e) {
|
||||
std::terminate(); // Terminate when it's a kotlin exception.
|
||||
} catch (...) {
|
||||
throw; // Just rethrow if it's unknown.
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class {
|
||||
|
||||
@@ -28,6 +28,8 @@ void ThrowException(KRef exception);
|
||||
|
||||
void SetKonanTerminateHandler();
|
||||
|
||||
void HandleCurrentExceptionForCInterop();
|
||||
|
||||
RUNTIME_NOTHROW OBJ_GETTER(Kotlin_getExceptionObject, void* holder);
|
||||
|
||||
// The functions below are implemented in Kotlin (at package kotlin.native.internal).
|
||||
|
||||
Reference in New Issue
Block a user