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

fix: Avoid crashing in NativeViewHost::SetParentAccessible on Windows 10 #26950

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions patches/chromium/.patches
Expand Up @@ -160,3 +160,4 @@ cherry-pick-5ffbb7ed173a.patch
propagate_disable-dev-shm-usage_to_child_processes.patch
cherry-pick-bbc6ab5bb49c.patch
cherry-pick-ecdec1fb0f42.patch
fix_setparentacessibile_crash_win.patch
28 changes: 28 additions & 0 deletions patches/chromium/fix_setparentacessibile_crash_win.patch
@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Biru Mohanathas <birunthan@mohanathas.com>
Date: Thu, 10 Dec 2020 19:02:37 +0200
Subject: fix crash in NativeViewHost::SetParentAccessible

This fixes random crashes on Windows 10. It presumably started happening
after the changes in
https://chromium.googlesource.com/chromium/src.git/+/5c6c8e994bce2bfb867279ae5068e9f9134e70c3%5E!/#F15

For context, see: https://github.com/electron/electron/issues/26905

This patch can likely be upstreamed. The crash cannot be fixed without
patching something in Chromium - this is the least invasive change.

diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
index b29553ae8f7b0f8bff44bb74b725dab5d5b9fa59..f51fa29c6d76623d58c0f4eb633b26fdddc30d55 100644
--- a/ui/views/controls/native/native_view_host.cc
+++ b/ui/views/controls/native/native_view_host.cc
@@ -54,6 +54,9 @@ void NativeViewHost::Detach() {
}

void NativeViewHost::SetParentAccessible(gfx::NativeViewAccessible accessible) {
+ if (!native_wrapper_.get())
+ return;
+
native_wrapper_->SetParentAccessible(accessible);
}