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 465540c

Browse filesBrowse files
ofrobotsgibfahn
authored andcommitted
src: destroy inspector agent before context
The inspector_agent depends on the context still being accessible during the destructor execution. PR-URL: #16472 Fixes: #15558 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 3b64fa4 commit 465540c
Copy full SHA for 465540c

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

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

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ inline Environment::Environment(IsolateData* isolate_data,
306306
emit_napi_warning_(true),
307307
makecallback_cntr_(0),
308308
#if HAVE_INSPECTOR
309-
inspector_agent_(this),
309+
inspector_agent_(new inspector::Agent(this)),
310310
#endif
311311
handle_cleanup_waiting_(0),
312312
http_parser_buffer_(nullptr),
@@ -347,6 +347,11 @@ inline Environment::Environment(IsolateData* isolate_data,
347347
inline Environment::~Environment() {
348348
v8::HandleScope handle_scope(isolate());
349349

350+
#if HAVE_INSPECTOR
351+
// Destroy inspector agent before erasing the context.
352+
delete inspector_agent_;
353+
#endif
354+
350355
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,
351356
nullptr);
352357
#define V(PropertyName, TypeName) PropertyName ## _.Reset();
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,8 @@ class Environment {
668668
#undef V
669669

670670
#if HAVE_INSPECTOR
671-
inline inspector::Agent* inspector_agent() {
672-
return &inspector_agent_;
671+
inline inspector::Agent* inspector_agent() const {
672+
return inspector_agent_;
673673
}
674674
#endif
675675

@@ -714,7 +714,7 @@ class Environment {
714714
std::map<std::string, uint64_t> performance_marks_;
715715

716716
#if HAVE_INSPECTOR
717-
inspector::Agent inspector_agent_;
717+
inspector::Agent* const inspector_agent_;
718718
#endif
719719

720720
HandleWrapQueue handle_wrap_queue_;

0 commit comments

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