fix(runtime): null-initialize Runtime::isolate_ - #460
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe ChangesRuntime initialization
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized lifecycle-safety fix gives Runtime::isolate_ a defined null state before initialization without changing behavior after successful setup. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Runtime::isolate_is only assigned near the end ofInit, after the context and its bindings are set up, so between construction and that point it holds an indeterminate value.~RuntimeandGetIsolate()read it unconditionally, andcurrentRuntime_already points at the runtime from the constructor on, so anything that reaches the runtime beforeInitfinishes gets garbage rather than null.This initializes it to
nullptr, the same waynapiEnv_next to it already is. No change for a runtime that completedInit.Summary by CodeRabbit