Fix deadlock caused by XFlush() reading events in X11SoftwareBitmapPresenter
Explanation copied from comment added by this CL: XFlush() flushes all requests and *also* reads events. It's unclear why it does this, but there's no alternative Xlib function that flushes the requests and *doesn't* read any events, so this workaround is necessary. In |event_task_runner_|'s message loop, poll() is called on the underlying XDisplay's fd to dispatch toplevel events. When the fd is readable, poll() exits and we (via Xlib) check for new events by read()ing from the fd. But if the event dispatcher is currently dispatching an event, then our call to XFlush() may read events into the event queue which will make the fd blocking since there's no more data to read, so poll() won't wake up until a new event comes, which may take a long time. Forcing the event loop to wake up with a dummy event fixes the race condition. BUG=1036742 R=msisov Change-Id: I4ce5dd1bbfd9c31a5e1adc992241937251fc3822 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1999436Reviewed-by:Maksim Sisov <msisov@igalia.com> Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> Cr-Commit-Position: refs/heads/master@{#731615}
Showing
Please register or sign in to comment