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<DesktopFrame> image(
new BasicDesktopFrame(DesktopSize(img->width, img->height)));