Add error trap for XFixesGetCursorImage()

BUG=https://code.google.com/p/webrtc/issues/detail?id=3245
R=jiayl@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/31519004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7362 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sergeyu@chromium.org 2014-10-01 23:07:12 +00:00
parent 325cff01b4
commit 76819d315d

View File

@ -182,9 +182,13 @@ bool MouseCursorMonitorX11::HandleXEvent(const XEvent& event) {
void MouseCursorMonitorX11::CaptureCursor() { void MouseCursorMonitorX11::CaptureCursor() {
assert(have_xfixes_); assert(have_xfixes_);
XFixesCursorImage* img = XFixesGetCursorImage(display()); XFixesCursorImage* img;
if (!img) {
XErrorTrap error_trap(display());
img = XFixesGetCursorImage(display());
if (!img || error_trap.GetLastErrorAndDisable() != 0)
return; return;
}
scoped_ptr<DesktopFrame> image( scoped_ptr<DesktopFrame> image(
new BasicDesktopFrame(DesktopSize(img->width, img->height))); new BasicDesktopFrame(DesktopSize(img->width, img->height)));