Native: add thread state switches to blockToKotlinImp

This commit is contained in:
Svyatoslav Scherbina
2022-02-03 16:53:08 +03:00
committed by Space
parent 925e7801aa
commit d235fc4dbe
@@ -493,6 +493,7 @@ static OBJ_GETTER(blockToKotlinImp, id block, SEL cmd) {
for (int i = 1; i <= parameterCount; ++i) {
const char* argEncoding = [signature getArgumentTypeAtIndex:i];
if (argEncoding[0] != '@') {
kotlin::ThreadStateGuard guard(kotlin::ThreadState::kNative);
[NSException raise:NSGenericException
format:@"Converting Obj-C blocks with non-reference-typed arguments to kotlin.Any is not supported (%s)", argEncoding];
}
@@ -500,6 +501,7 @@ static OBJ_GETTER(blockToKotlinImp, id block, SEL cmd) {
const char* returnTypeEncoding = signature.methodReturnType;
if (returnTypeEncoding[0] != '@') {
kotlin::ThreadStateGuard guard(kotlin::ThreadState::kNative);
[NSException raise:NSGenericException
format:@"Converting Obj-C blocks with non-reference-typed return value to kotlin.Any is not supported (%s)", returnTypeEncoding];
}