Index: ui/events/ozone/evdev/event_factory_evdev.cc |
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc |
index bee96cd1a39d423642fdadf22d8b7565ab75508c..8b148a3c898267aab18f4a2ef6c73c39a44e5c76 100644 |
--- a/ui/events/ozone/evdev/event_factory_evdev.cc |
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc |
@@ -144,8 +144,13 @@ void EventFactoryEvdev::Init() { |
} |
scoped_ptr<SystemInputInjector> EventFactoryEvdev::CreateSystemInputInjector() { |
- return make_scoped_ptr(new InputInjectorEvdev( |
- &modifiers_, cursor_, &keyboard_, dispatch_callback_)); |
+ // Use forwarding dispatcher for the injector rather than dispatching |
+ // directly. We cannot assume it is safe to (re-)enter ui::Event dispatch |
+ // synchronously from the injection point. |
+ scoped_ptr<DeviceEventDispatcherEvdev> dispatcher( |
+ new ProxyDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(), |
+ weak_ptr_factory_.GetWeakPtr())); |
+ return make_scoped_ptr(new InputInjectorEvdev(dispatcher.Pass(), cursor_)); |
} |
void EventFactoryEvdev::DispatchKeyEvent(const KeyEventParams& params) { |