Skip to content

Commit 3e323e0

Browse files
committed
fix: dont keep holding napiscope when running UIApplicationMain
1 parent c51ad7e commit 3e323e0

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

NativeScript/ffi/CFunction.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@
8585
memcpy(avaluesPtr, avalues, cif->argc * sizeof(void*));
8686

8787
Tasks::Register([env, cif, func, rvalue, avaluesPtr]() {
88-
NapiScope scope(env);
89-
9088
void * avalues[cif->argc];
9189
memcpy(avalues, avaluesPtr, cif->argc * sizeof(void*));
9290
delete[] avaluesPtr;
9391

9492
@try {
9593
ffi_call(&cif->cif, FFI_FN(func->fnptr), rvalue, avalues);
9694
} @catch (NSException* exception) {
95+
NapiScope scope(env);
9796
std::string message = exception.description.UTF8String;
9897
NSLog(@"ObjC->JS: Exception in CFunction (task): %s", message.c_str());
9998
nativescript::NativeScriptException nativeScriptException(message);

NativeScript/ffi/Closure.mm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ void JSBlockCallback(ffi_cif* cif, void* ret, void* args[], void* data) {
162162
ctx.cv.wait(lock, [&ctx] { return ctx.done; });
163163
napi_release_threadsafe_function(closure->tsfn, napi_tsfn_release);
164164
#else
165-
NSLog(@"Threadsafe functions are not supported");
166-
// assert(false && "Threadsafe functions are not supported");
167165
Closure::callBlockFromMainThread(env, get_ref_value(env, closure->func), closure, &ctx);
168166
#endif // ENABLE_JS_RUNTIME
169167
}

0 commit comments

Comments
 (0)