Skip to content

fix: destroy MessageDispatcher before WebContents - #28286

Merged
zcbenz merged 1 commit into
masterfrom
clear-delegate-before-destroy
Mar 22, 2021
Merged

zcbenz merged 1 commit into
masterfrom
clear-delegate-before-destroy

Conversation

@zcbenz

@zcbenz zcbenz commented Mar 19, 2021

Copy link
Copy Markdown
Contributor

Description of Change

The DevToolsEmbedderMessageDispatcher and DevToolsFrontendHost instances should be destroyed before destroying the WebContents, otherwise there might be race conditions when handling messages from the WebContents. This matches the destruction order in Chromium's chrome/browser/devtools/devtools_ui_bindings.h.

This should be able to fix the crash when testing devtools in CI:

0   Electron Framework                  0x0000000110427549 base::debug::CollectStackTrace(void**, unsigned long) + 9
1   Electron Framework                  0x0000000110343a43 base::debug::StackTrace::StackTrace() + 19
2   Electron Framework                  0x0000000110427471 base::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*, void*) + 2385
3   libsystem_platform.dylib            0x00007fff69ef05fd _sigtramp + 29
4   ???                                 0x0000000000000030 0x0 + 48
5   Electron Framework                  0x000000010bb70241 electron::api::WebContents::DevToolsOpened() + 545
6   Electron Framework                  0x000000010bc23ce8 electron::InspectableWebContents::LoadCompleted() + 904
7   Electron Framework                  0x0000000115533238 bool (anonymous namespace)::ParseAndHandle<>(base::RepeatingCallback<void ()> const&, base::OnceCallback<void (base::Value const*)>, base::ListValue const&) + 216
8   Electron Framework                  0x000000011553327a base::internal::Invoker<base::internal::BindState<bool (*)(base::RepeatingCallback<void ()> const&, base::OnceCallback<void (base::Value const*)>, base::ListValue const&), base::RepeatingCallback<void ()> >, bool (base::OnceCallback<void (base::Value const*)>, base::ListValue const&)>::Run(base::internal::BindStateBase*, base::OnceCallback<void (base::Value const*)>&&, base::ListValue const&) + 42
9   Electron Framework                  0x0000000115532f29 DispatcherImpl::Dispatch(base::OnceCallback<void (base::Value const*)>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, base::ListValue const*) + 137
10  Electron Framework                  0x000000010bc26742 electron::InspectableWebContents::HandleMessageFromDevToolsFrontend(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 450

Checklist

Release Notes

Notes: none

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 19, 2021
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Mar 20, 2021
@zcbenz
zcbenz merged commit c8d18a0 into master Mar 22, 2021
@release-clerk

release-clerk Bot commented Mar 22, 2021

Copy link
Copy Markdown

No Release Notes

@zcbenz
zcbenz deleted the clear-delegate-before-destroy branch March 22, 2021 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants