GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — inspector: fix session.disconnect crash · nodejs/node@f6ec81d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • inspector_js_api.cc
  • test/parallel
    • test-inspector-connect-to-main-thread.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/inspector_js_api.cc‎

Copy file name to clipboardExpand all lines: src/inspector_js_api.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@ class JSBindingsConnection : public AsyncWrap {
123123
new JSBindingsConnection(env, info.This(), callback);
124124
}
125125

126+
// See https://github.com/nodejs/node/pull/46942
126127
void Disconnect() {
128+
BaseObjectPtr<JSBindingsConnection> strong_ref{this};
127129
session_.reset();
128-
delete this;
130+
Detach();
129131
}
130132

131133
static void Disconnect(const FunctionCallbackInfo<Value>& info) {
Collapse file

‎test/parallel/test-inspector-connect-to-main-thread.js‎

Copy file name to clipboard
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
common.skipIfInspectorDisabled();
5+
6+
const { Session } = require('inspector');
7+
const { Worker, isMainThread, workerData } = require('worker_threads');
8+
9+
if (!workerData) {
10+
common.skipIfWorker();
11+
}
12+
13+
if (isMainThread) {
14+
new Worker(__filename, { workerData: {} });
15+
} else {
16+
const session = new Session();
17+
session.connectToMainThread();
18+
// Do not crash
19+
session.disconnect();
20+
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.