From c3f83a83fbfa9d6f74a54d93347084c898fe274b Mon Sep 17 00:00:00 2001 From: Adrian Niculescu <15037449+adrian-niculescu@users.noreply.github.com> Date: Fri, 28 Aug 2026 13:06:48 +0300 Subject: [PATCH] fix(runtime): null-initialize Runtime::isolate_ Init assigns isolate_ only after the context and its bindings are set up, so from construction until then the member holds an indeterminate value. The destructor and GetIsolate() read it unconditionally, and currentRuntime_ already points at the runtime from the constructor on. Initialize it to nullptr, like napiEnv_, so a runtime that has not completed Init reports no isolate instead of garbage. --- NativeScript/runtime/Runtime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NativeScript/runtime/Runtime.h b/NativeScript/runtime/Runtime.h index f85de578..f406116b 100644 --- a/NativeScript/runtime/Runtime.h +++ b/NativeScript/runtime/Runtime.h @@ -159,7 +159,7 @@ class Runtime { static void DrainRejectionsObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void* info); - v8::Isolate* isolate_; + v8::Isolate* isolate_ = nullptr; std::atomic terminationRequested_{false}; napi_env napiEnv_ = nullptr; std::unique_ptr moduleInternal_;