electron/patches/node/fix_cppgc_initializing_twice.patch
electron-roller[bot] 82a59d9894
chore: bump node to v22.16.0 (main) (#47217)
* chore: bump node in DEPS to v22.16.0

* crypto: remove BoringSSL dh-primes addition

https://github.com/nodejs/node/pull/57023

* tools: enable linter in test/fixtures/test\-runner/output

https://github.com/nodejs/node/pull/57698

* src: improve thread safety of TaskQueue

https://github.com/nodejs/node/pull/57910

* buffer: define global v8::CFunction objects as const

https://github.com/nodejs/node/pull/57676

* src: disable abseil deadlock detection

https://github.com/nodejs/node/pull/57582

* zlib: fix pointer alignment

https://github.com/nodejs/node/pull/57727

* chore: fixup patch indices

* src: set default config as node.config.json

https://github.com/nodejs/node/pull/57171

* src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>

https://github.com/nodejs/node/pull/57578

* test: disable chmod tests failing in Docker

https://github.com/nodejs/node/issues/58326

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-06-02 17:30:15 -04: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 bc670a6c8b5027417cdc35e1cd94a60f63fd342d..49a9670de72c222d6b4a681be001efb4a2651ea3 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1209,7 +1209,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();