Commit 36561a25 authored by Nick Diego Yamane's avatar Nick Diego Yamane Committed by Commit Bot

x11: Fix crash when coalescing XEvents

After crrev.com/c/2022280, logic for coalescing XEvents has been moved
to ui::X11Window [1], there are cases where translating coalesced XEvent
results in ET_UNKNOWN events. Before migrating away from PlatformEvent
based ui::*Event ctors to XEvent translation helper functions, handling
such cases was a matter of checking its ::type() value, now translation
functions return nullptr instead, so update this checking accordingly.

[1] https://crrev.com/c/2022280/18/ui/base/x/x11_window.cc#b1196

R=thomasanderson@chromium.org

Bug: 1052293, 1052301
Test: Run with ozone/x11 backend, scroll, browser should not crashed
Change-Id: Icf415ce72e679f39598f9d72ad098d56217e21da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057072
Commit-Queue: Scott Violet <sky@chromium.org>
Auto-Submit: Nick Yamane <nickdiego@igalia.com>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741602}
parent ef347c08
......@@ -589,13 +589,13 @@ void X11Window::DispatchUiEvent(ui::Event* event, XEvent* xev) {
event = last_motion.get();
}
// If after CoalescePendingMotionEvents the type of xev is resolved
// to UNKNOWN, don't dispatch the event. TODO(804418): investigate
// why ColescePendingMotionEvents can include mouse wheel events as
// well. Investigation showed that events on Linux are checked with
// cmt-device path, and can include DT_CMT_SCROLL_ data. See more
// discussion in https://crrev.com/c/853953
if (event->type() != ui::ET_UNKNOWN) {
// If after CoalescePendingMotionEvents the type of xev is resolved to
// UNKNOWN, i.e: xevent translation returns nullptr, don't dispatch the
// event. TODO(804418): investigate why ColescePendingMotionEvents can
// include mouse wheel events as well. Investigation showed that events on
// Linux are checked with cmt-device path, and can include DT_CMT_SCROLL_
// data. See more discussion in https://crrev.com/c/853953
if (event) {
#if defined(USE_OZONE)
DispatchEventFromNativeUiEvent(
event, base::BindOnce(&PlatformWindowDelegate::DispatchEvent,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment