File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,9 @@ void SignalHandler::HandleProfilerSignal(int sig,
291291 return ;
292292 }
293293 auto isolate = Isolate::GetCurrent ();
294+ if (!isolate || isolate->IsDead ()) {
295+ return ;
296+ }
294297 WallProfiler* prof = g_profilers.GetProfiler (isolate);
295298
296299 if (!prof) {
Original file line number Diff line number Diff line change @@ -155,14 +155,18 @@ class WallProfiler : public Nan::ObjectWrap {
155155 int64_t GetAsyncId (v8::Isolate* isolate) const {
156156 if (gcCount > 0 ) {
157157 return gcAsyncId;
158+ } else if (isolate->InContext ()) {
159+ return static_cast <int64_t >(node::AsyncHooksGetExecutionAsyncId (isolate));
158160 }
159- return static_cast < int64_t >( node::AsyncHooksGetExecutionAsyncId (isolate)) ;
161+ return - 1 ;
160162 }
161163
162164 void OnGCStart (v8::Isolate* isolate) {
163- if (gcCount++ == 0 ) {
164- gcAsyncId =
165- static_cast <int64_t >(node::AsyncHooksGetExecutionAsyncId (isolate));
165+ if (gcCount == 0 ) {
166+ gcAsyncId = GetAsyncId (isolate);
167+ gcCount = 1 ;
168+ } else {
169+ ++gcCount;
166170 }
167171 }
168172
You can’t perform that action at this time.
0 commit comments