Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Avoid crashing in NativeViewHost::SetParentAccessible on Windows
This fixes #26905. The patch was obtained from @deepak1556, who in turn got it from the Microsoft Teams folks. I believe the crash started happening due to the changes in https://chromium.googlesource.com/chromium/src.git/+/5c6c8e994bce2bfb867279ae5068e9f9134e70c3%5E!/#F15 This affects Electron 9 and later. Notes: Fix occasional crash on Windows
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
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,25 @@ | ||
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 | ||
|
||
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); | ||
} | ||
|