| Index: ui/events/platform/x11/x11_hotplug_event_handler.cc
|
| diff --git a/ui/events/platform/x11/x11_hotplug_event_handler.cc b/ui/events/platform/x11/x11_hotplug_event_handler.cc
|
| index b05de3c33236ecbb82542c40d9d65ed768b4ebf5..be7bb0911d20c6c3339396ab3d825d17f26f1f8e 100644
|
| --- a/ui/events/platform/x11/x11_hotplug_event_handler.cc
|
| +++ b/ui/events/platform/x11/x11_hotplug_event_handler.cc
|
| @@ -215,7 +215,11 @@ base::FilePath GetDevicePath(XDisplay* dpy, const XIDeviceInfo& device) {
|
| unsigned long nitems, bytes_after;
|
| unsigned char* data;
|
| XDevice* dev = XOpenDevice(dpy, device.deviceid);
|
| - if (!dev)
|
| +
|
| + // Sometimes XOpenDevice() doesn't return null but the contents aren't valid.
|
| + // Calling XGetDeviceProperty() when dev->device_id is invalid triggers a
|
| + // BadDevice error. Return early to avoid a crash. http://crbug.com/659261
|
| + if (!dev || dev->device_id != base::checked_cast<XID>(device.deviceid))
|
| return base::FilePath();
|
|
|
| if (XGetDeviceProperty(dpy,
|
|
|