From ddb0ab81870f76f6e2741aa494dc2318d59e4819 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 12 Jul 2024 14:13:10 -0400 Subject: [PATCH] Fix DCHECK adding menu separator with hidden items (fixes #3577) --- patch/patch.cfg | 6 ++++++ patch/patches/ui_menu_model_3577.patch | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 patch/patches/ui_menu_model_3577.patch diff --git a/patch/patch.cfg b/patch/patch.cfg index d0eea34f4..1b6d950d0 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -726,5 +726,11 @@ patches = [ # Linux: Fix ARM build broken by build_tflite_with_xnnpack change. # https://issues.chromium.org/issues/348117454 'name': 'linux_tflite_348117454' + }, + { + # Fix DCHECK in SimpleMenuModel::AddSeparator when adding a separator with + # hidden menu items. + # https://github.com/chromiumembedded/cef/issues/3577 + 'name': 'ui_menu_model_3577' } ] diff --git a/patch/patches/ui_menu_model_3577.patch b/patch/patches/ui_menu_model_3577.patch new file mode 100644 index 000000000..a289a2a53 --- /dev/null +++ b/patch/patches/ui_menu_model_3577.patch @@ -0,0 +1,23 @@ +diff --git ui/base/models/simple_menu_model.cc ui/base/models/simple_menu_model.cc +index 88e27362452e5..9c18ac5c77544 100644 +--- ui/base/models/simple_menu_model.cc ++++ ui/base/models/simple_menu_model.cc +@@ -10,6 +10,7 @@ + #include "base/functional/bind.h" + #include "base/location.h" + #include "base/task/single_thread_task_runner.h" ++#include "cef/libcef/features/features.h" + #include "ui/base/l10n/l10n_util.h" + #include "ui/base/models/image_model.h" + #include "ui/gfx/image/image.h" +@@ -170,8 +171,10 @@ void SimpleMenuModel::AddSeparator(MenuSeparatorType separator_type) { + } + + if (items_.at(last_visible_item).type == TYPE_SEPARATOR) { ++#if !BUILDFLAG(ENABLE_CEF) + DCHECK_EQ(NORMAL_SEPARATOR, separator_type); + DCHECK_EQ(NORMAL_SEPARATOR, items_.at(last_visible_item).separator_type); ++#endif + // The last item is already a separator. Don't add another. + return; + }