inspector: turn platform tasks that outlive Agent into no-ops · nodejs/node@4277066 · GitHub
Skip to content

Commit 4277066

Browse files
addaleaxtargos
authored andcommitted
inspector: turn platform tasks that outlive Agent into no-ops
Turn tasks scheduled on the `v8::Isolate` or on the given platform into no-ops if the underlying `MainThreadInterface` has gone away before the task could be run (which would happen when the `Environment` instance and with it the `inspector::Agent` instance are destroyed). This addresses an issue that Electron has been having with inspector support, and generally just seems like the right thing to do, as we may not fully be in control of the relative timing of Environment teardown, platform tasksexecution, and the execution of `RequestInterrupt()` callbacks (although the former two always happen in the same order in our own code). PR-URL: #30031 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 58c585e commit 4277066

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/inspector/main_thread_interface.cc

Lines changed: 13 additions & 8 deletions

src/inspector/main_thread_interface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ class MainThreadHandle : public std::enable_shared_from_this<MainThreadHandle> {
7070
friend class MainThreadInterface;
7171
};
7272

73-
class MainThreadInterface {
73+
class MainThreadInterface :
74+
public std::enable_shared_from_this<MainThreadInterface> {
7475
public:
7576
MainThreadInterface(Agent* agent, uv_loop_t*, v8::Isolate* isolate,
7677
v8::Platform* platform);

src/inspector_agent.cc

Lines changed: 4 additions & 4 deletions

0 commit comments

Comments
 (0)