Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: destroy inspector agent before context #16472

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ inline Environment::Environment(IsolateData* isolate_data,
emit_napi_warning_(true),
makecallback_cntr_(0),
#if HAVE_INSPECTOR
inspector_agent_(this),
inspector_agent_(new inspector::Agent(this)),
#endif
handle_cleanup_waiting_(0),
http_parser_buffer_(nullptr),
Expand Down Expand Up @@ -347,6 +347,11 @@ inline Environment::Environment(IsolateData* isolate_data,
inline Environment::~Environment() {
v8::HandleScope handle_scope(isolate());

#if HAVE_INSPECTOR
// Destroy inspector agent before erasing the context.
delete inspector_agent_;
#endif

context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,
nullptr);
#define V(PropertyName, TypeName) PropertyName ## _.Reset();
Expand Down
6 changes: 3 additions & 3 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ class Environment {
#undef V

#if HAVE_INSPECTOR
inline inspector::Agent* inspector_agent() {
return &inspector_agent_;
inline inspector::Agent* inspector_agent() const {
return inspector_agent_;
}
#endif

Expand Down Expand Up @@ -713,7 +713,7 @@ class Environment {
std::map<std::string, uint64_t> performance_marks_;

#if HAVE_INSPECTOR
inspector::Agent inspector_agent_;
inspector::Agent* const inspector_agent_;
#endif

HandleWrapQueue handle_wrap_queue_;
Expand Down