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 #26924
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 f9e1aa1b455ae49b59d53a75ae0634d0c092a130..4785f0c0368e0ab22db0cc968ad85d23a9b26240 100644 | ||
--- a/ui/views/controls/native/native_view_host.cc | ||
+++ b/ui/views/controls/native/native_view_host.cc | ||
@@ -55,6 +55,9 @@ void NativeViewHost::Detach() { | ||
} | ||
|
||
void NativeViewHost::SetParentAccessible(gfx::NativeViewAccessible accessible) { | ||
+ if (!native_wrapper_.get()) | ||
+ return; | ||
+ | ||
native_wrapper_->SetParentAccessible(accessible); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We require all patches to describe a plan for their own removal, or else a reason why they should be maintained forever, per https://github.com/electron/electron/blob/master/docs/development/patches.md#patch-justification.
Can this patch be upstreamed? If not, why not? Can we fix this crash without a patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nornagon Updated!