macOS: Fix crash when showing a select popup with CefDoMessageLoopWork (issue #2495)

This commit is contained in:
Marshall Greenblatt 2018-09-28 16:27:09 +02:00
parent 847fd4fd63
commit b472a8d9ea
2 changed files with 29 additions and 0 deletions

View File

@ -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',
}
]

View File

@ -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);
}