From b472a8d9ea422f6fda63c4f291ba80e5794fca52 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 28 Sep 2018 16:27:09 +0200 Subject: [PATCH] macOS: Fix crash when showing a select popup with CefDoMessageLoopWork (issue #2495) --- patch/patch.cfg | 5 +++++ patch/patches/message_pump_mac_2495.patch | 24 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 patch/patches/message_pump_mac_2495.patch diff --git a/patch/patch.cfg b/patch/patch.cfg index d44c41a0f..fbab06846 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -402,5 +402,10 @@ patches = [ # Fix redraw of OSR PDF viewer. # https://bitbucket.org/chromiumembedded/cef/issues/2507 'name': 'browser_child_frame_2507', + }, + { + # macOS: Fix crash when showing a select popup with CefDoMessageLoopWork. + # https://bitbucket.org/chromiumembedded/cef/issues/2495 + 'name': 'message_pump_mac_2495', } ] diff --git a/patch/patches/message_pump_mac_2495.patch b/patch/patches/message_pump_mac_2495.patch new file mode 100644 index 000000000..3dab9ff47 --- /dev/null +++ b/patch/patches/message_pump_mac_2495.patch @@ -0,0 +1,24 @@ +diff --git base/message_loop/message_pump_mac.mm base/message_loop/message_pump_mac.mm +index fb2520179995..165a8d4b4b29 100644 +--- base/message_loop/message_pump_mac.mm ++++ base/message_loop/message_pump_mac.mm +@@ -761,7 +761,8 @@ explicit MessagePumpScopedAutoreleasePool(MessagePumpCFRunLoopBase* pump) : + #else + + ScopedPumpMessagesInPrivateModes::ScopedPumpMessagesInPrivateModes() { +- DCHECK(g_app_pump); ++ if (!g_app_pump) ++ return; + DCHECK_EQ(kNSApplicationModalSafeModeMask, g_app_pump->GetModeMask()); + // Pumping events in private runloop modes is known to interact badly with + // app modal windows like NSAlert. +@@ -770,7 +771,8 @@ explicit MessagePumpScopedAutoreleasePool(MessagePumpCFRunLoopBase* pump) : + } + + ScopedPumpMessagesInPrivateModes::~ScopedPumpMessagesInPrivateModes() { +- DCHECK(g_app_pump); ++ if (!g_app_pump) ++ return; + g_app_pump->SetModeMask(kNSApplicationModalSafeModeMask); + } +