fix: crash on nativeTheme change during context menu close (#38824)
This commit is contained in:
parent
97132ece33
commit
b693f88491
2 changed files with 43 additions and 0 deletions
|
@ -127,3 +127,4 @@ chore_defer_usb_service_getdevices_request_until_usb_service_is.patch
|
|||
fix_remove_profiles_from_spellcheck_service.patch
|
||||
chore_patch_out_profile_methods_in_chrome_browser_pdf.patch
|
||||
chore_patch_out_profile_methods_in_titlebar_config.patch
|
||||
fix_crash_on_nativetheme_change_during_context_menu_close.patch
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Fri, 16 Jun 2023 11:15:57 +0200
|
||||
Subject: fix: crash on nativeTheme change during context menu close
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/chromium/src/+/4363385
|
||||
|
||||
Fixes a crash seen when trying to change nativeTheme source during
|
||||
a context menu close. This happens as a result of a change added in the
|
||||
above CL, which doesn't check whether or not the menu controller could
|
||||
possibly be null as can happen during a context menu close. This
|
||||
only affects Windows 11, as Bubble Border is only enabled there.
|
||||
|
||||
This should be upstreamed, as other uses of MenuController in this
|
||||
file do check for menu controller being null.
|
||||
|
||||
diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc
|
||||
index 76bb4863858fb1bde1288b3d1b1d07f151a2f801..f2ceb3b8d6cbcf4bb4af8b85573bba29a38e5abf 100644
|
||||
--- a/ui/views/controls/menu/menu_scroll_view_container.cc
|
||||
+++ b/ui/views/controls/menu/menu_scroll_view_container.cc
|
||||
@@ -402,8 +402,7 @@ void MenuScrollViewContainer::CreateDefaultBorder() {
|
||||
MenuController* menu_controller =
|
||||
content_view_->GetMenuItem()->GetMenuController();
|
||||
const MenuConfig& menu_config = MenuConfig::instance();
|
||||
- corner_radius_ = menu_config.CornerRadiusForMenu(
|
||||
- content_view_->GetMenuItem()->GetMenuController());
|
||||
+ corner_radius_ = menu_config.CornerRadiusForMenu(menu_controller);
|
||||
int padding = menu_config.use_outer_border && corner_radius_ > 0
|
||||
? kBorderPaddingDueToRoundedCorners
|
||||
: 0;
|
||||
@@ -418,8 +417,9 @@ void MenuScrollViewContainer::CreateDefaultBorder() {
|
||||
int bottom_inset = GetFootnote() ? 0 : vertical_inset;
|
||||
|
||||
if (menu_config.use_outer_border) {
|
||||
- if (menu_config.use_bubble_border && (corner_radius_ > 0) &&
|
||||
- !menu_controller->IsCombobox()) {
|
||||
+ // Menu controller could be null during context menu being closed.
|
||||
+ bool is_combobox = menu_controller && !menu_controller->IsCombobox();
|
||||
+ if (menu_config.use_bubble_border && (corner_radius_ > 0) && !is_combobox) {
|
||||
CreateBubbleBorder();
|
||||
} else {
|
||||
gfx::Insets insets = gfx::Insets::TLBR(vertical_inset, horizontal_inset,
|
Loading…
Reference in a new issue