Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a28c990

Browse filesBrowse files
Jichanaddaleax
andcommitted
src: fix what a dispose without checking
If created platform with CreatePlatform, the crash occurs because it does not check if it was initialized to v8_platform when DisposePlatform was called. Backport-PR-URL: #35241 Refs: #31260 Co-authored-by: Anna Henningsen <anna@addaleax.net> PR-URL: #30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 2f8f767 commit a28c990
Copy full SHA for a28c990

File tree

Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Open diff view settings
Collapse file

‎src/node_v8_platform-inl.h‎

Copy file name to clipboardExpand all lines: src/node_v8_platform-inl.h
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "tracing/node_trace_writer.h"
1313
#include "tracing/trace_event.h"
1414
#include "tracing/traced_value.h"
15+
#include "util.h"
1516

1617
namespace node {
1718

@@ -79,8 +80,12 @@ class NodeTraceStateObserver
7980
};
8081

8182
struct V8Platform {
83+
bool initialized_ = false;
84+
8285
#if NODE_USE_V8_PLATFORM
8386
inline void Initialize(int thread_pool_size) {
87+
CHECK(!initialized_);
88+
initialized_ = true;
8489
tracing_agent_ = std::make_unique<tracing::Agent>();
8590
node::tracing::TraceEventHelper::SetAgent(tracing_agent_.get());
8691
node::tracing::TracingController* controller =
@@ -99,6 +104,10 @@ struct V8Platform {
99104
}
100105

101106
inline void Dispose() {
107+
if (!initialized_)
108+
return;
109+
initialized_ = false;
110+
102111
StopTracingAgent();
103112
platform_->Shutdown();
104113
delete platform_;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.