diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc b/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc index f09593db9d..f5c454e6cf 100644 --- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc +++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc @@ -182,9 +182,13 @@ bool MouseCursorMonitorX11::HandleXEvent(const XEvent& event) { void MouseCursorMonitorX11::CaptureCursor() { assert(have_xfixes_); - XFixesCursorImage* img = XFixesGetCursorImage(display()); - if (!img) - return; + XFixesCursorImage* img; + { + XErrorTrap error_trap(display()); + img = XFixesGetCursorImage(display()); + if (!img || error_trap.GetLastErrorAndDisable() != 0) + return; + } scoped_ptr image( new BasicDesktopFrame(DesktopSize(img->width, img->height)));