From f50fda9534563885ab080ae18c2540a0f5b930bc Mon Sep 17 00:00:00 2001 From: zijiehe Date: Tue, 8 Aug 2017 10:35:11 -0700 Subject: [PATCH] Ignore invalid mouse cursor image A crash has been randomly detected across different versions. The NSImage crashes the binary in its lockFocusFlipped() function. The suspicious issue is that NSCursor::image() returns an invalid NSImage. BUG=chromium:752036 Review-Url: https://codereview.webrtc.org/2993173003 Cr-Commit-Position: refs/heads/master@{#19273} --- webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm b/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm index 2bb06b7b4b..371852bf42 100644 --- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm +++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm @@ -256,6 +256,9 @@ void MouseCursorMonitorMac::CaptureImage(float scale) { NSCursor* nscursor = [NSCursor currentSystemCursor]; NSImage* nsimage = [nscursor image]; + if (nsimage == nil || !nsimage.isValid) { + return; + } NSSize nssize = [nsimage size]; // DIP size // No need to caputre cursor image if it's unchanged since last capture.