Skip to content

Commit a29bc7a

Browse files
committed
fix: properly lock the isolate when re-entering from timer callback
1 parent 0055c99 commit a29bc7a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

NativeScript/runtime/modules/timers/Timers.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "js_native_api.h"
22
#include "js_native_api_types.h"
3+
#include "jsr.h"
34
#ifdef __APPLE__
45

56
#import <Foundation/Foundation.h>
@@ -36,6 +37,7 @@
3637
timerWithTimeInterval:interval
3738
repeats:NO
3839
block:^(NSTimer* timer) {
40+
NapiScope scope(env);
3941
napi_value global, callbackValue;
4042
napi_get_global(env, &global);
4143
napi_get_reference_value(env, callback, &callbackValue);
@@ -71,6 +73,7 @@
7173
timerWithTimeInterval:interval
7274
repeats:YES
7375
block:^(NSTimer* timer) {
76+
NapiScope scope(env);
7477
napi_value global, callbackValue;
7578
napi_get_global(env, &global);
7679
napi_get_reference_value(env, callback, &callbackValue);

0 commit comments

Comments
 (0)