fix_setparentacessibile_crash_win.patch 1.1 KB

12345678910111213141516171819202122232425262728
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Biru Mohanathas <[email protected]>
  3. Date: Thu, 10 Dec 2020 19:02:37 +0200
  4. Subject: fix crash in NativeViewHost::SetParentAccessible
  5. This fixes random crashes on Windows 10. It presumably started happening
  6. after the changes in
  7. https://chromium.googlesource.com/chromium/src.git/+/5c6c8e994bce2bfb867279ae5068e9f9134e70c3%5E!/#F15
  8. For context, see: https://github.com/electron/electron/issues/26905
  9. This patch can likely be upstreamed. The crash cannot be fixed without
  10. patching something in Chromium - this is the least invasive change.
  11. diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
  12. index a5a09b31bd8d228e5cb162c771260ea38e85d494..a1f7f8871cf2da7bc898d03948ea4057e73c669c 100644
  13. --- a/ui/views/controls/native/native_view_host.cc
  14. +++ b/ui/views/controls/native/native_view_host.cc
  15. @@ -55,6 +55,9 @@ void NativeViewHost::Detach() {
  16. }
  17. void NativeViewHost::SetParentAccessible(gfx::NativeViewAccessible accessible) {
  18. + if (!native_wrapper_.get())
  19. + return;
  20. +
  21. native_wrapper_->SetParentAccessible(accessible);
  22. }