electron/patches/node/fix_cppgc_initializing_twice.patch
electron-roller[bot] 8647ef3870
chore: bump node to v22.21.1 (37-x-y) (#48614)
* chore: bump node in DEPS to v22.21.0

* chore: bump node in DEPS to v22.21.1

* chore: update patches

* lib,src: refactor assert to load error source from memory

nodejs/node#59751

* src: add percentage support to --max-old-space-size

nodejs/node#59082

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-10-31 12:00:01 -05:00

26 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Maddock <smaddock@slack-corp.com>
Date: Thu, 27 Mar 2025 17:00:11 -0400
Subject: fix: cppgc initializing twice
Refs https://chromium-review.googlesource.com/c/v8/v8/+/6333562
cppgc will now be initialized as part of V8::Initialize. For now, skip
initialization if it's already been initialized.
This can be removed/refactored once Node.js upgrades to a version of V8
containing the above CL.
diff --git a/src/node.cc b/src/node.cc
index 2224b5d4e21f435cff1f1ebef2b9e8635bd0368e..4830d5b738f40e035394d5eff76bb3b801f193fb 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1239,7 +1239,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
result->platform_ = per_process::v8_platform.Platform();
}
- if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc)) {
+ if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc) && !cppgc::IsInitialized()) {
v8::PageAllocator* allocator = nullptr;
if (result->platform_ != nullptr) {
allocator = result->platform_->GetPageAllocator();