From c363d006a8806d1be4be58cd7689359ad24de6f0 Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Tue, 30 Nov 2010 01:08:18 +0000 Subject: Fix 2 crashers in remoting client. There are two issues: 1) VideoReader::Create() was returning null for VP8 over TCP. 2) InputHandler was trying to send events before InputStub is created. BUG=None TEST=remoting client works Review URL: http://codereview.chromium.org/5327002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67638 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/client/input_handler.cc | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'remoting/client') diff --git a/remoting/client/input_handler.cc b/remoting/client/input_handler.cc index 87c3c89..7048e73 100644 --- a/remoting/client/input_handler.cc +++ b/remoting/client/input_handler.cc @@ -19,31 +19,37 @@ InputHandler::InputHandler(ClientContext* context, } void InputHandler::SendKeyEvent(bool press, int keycode) { - KeyEvent* event = new KeyEvent(); - event->set_key(keycode); - event->set_pressed(press); - protocol::InputStub* stub = connection_->input_stub(); - stub->InjectKeyEvent(event, new DeleteTask(event)); + if (stub) { + KeyEvent* event = new KeyEvent(); + event->set_key(keycode); + event->set_pressed(press); + + stub->InjectKeyEvent(event, new DeleteTask(event)); + } } void InputHandler::SendMouseMoveEvent(int x, int y) { - MouseEvent* event = new MouseEvent(); - event->set_x(x); - event->set_y(y); - protocol::InputStub* stub = connection_->input_stub(); - stub->InjectMouseEvent(event, new DeleteTask(event)); + if (stub) { + MouseEvent* event = new MouseEvent(); + event->set_x(x); + event->set_y(y); + + stub->InjectMouseEvent(event, new DeleteTask(event)); + } } void InputHandler::SendMouseButtonEvent(bool button_down, MouseButton button) { - MouseEvent* event = new MouseEvent(); - event->set_button(button); - event->set_button_down(button_down); - protocol::InputStub* stub = connection_->input_stub(); - stub->InjectMouseEvent(event, new DeleteTask(event)); + if (stub) { + MouseEvent* event = new MouseEvent(); + event->set_button(button); + event->set_button_down(button_down); + + stub->InjectMouseEvent(event, new DeleteTask(event)); + } } } // namespace remoting -- cgit v1.1