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 b1802ed

Browse filesBrowse files
fhinkelgibfahn
authored andcommitted
src: turn inspector raw pointer into unique_ptr
Use a unique pointer to make ownership clear. PR-URL: #16974 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
1 parent ad331f2 commit b1802ed
Copy full SHA for b1802ed

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

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

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,9 @@ inline Environment::~Environment() {
347347
v8::HandleScope handle_scope(isolate());
348348

349349
#if HAVE_INSPECTOR
350-
// Destroy inspector agent before erasing the context.
351-
delete inspector_agent_;
350+
// Destroy inspector agent before erasing the context. The inspector
351+
// destructor depends on the context still being accessible.
352+
inspector_agent_.reset(nullptr);
352353
#endif
353354

354355
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ class Environment {
673673

674674
#if HAVE_INSPECTOR
675675
inline inspector::Agent* inspector_agent() const {
676-
return inspector_agent_;
676+
return inspector_agent_.get();
677677
}
678678
#endif
679679

@@ -718,7 +718,7 @@ class Environment {
718718
std::map<std::string, uint64_t> performance_marks_;
719719

720720
#if HAVE_INSPECTOR
721-
inspector::Agent* const inspector_agent_;
721+
std::unique_ptr<inspector::Agent> inspector_agent_;
722722
#endif
723723

724724
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.