mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-01 23:20:55 +00:00
vbox: avoid null access in input handling
that happened during early bootup. The signal about input events may arrive before keyboard and mouse is set (due wait_and_dispatch_one_signal called from a started pthread and ep still not done with the initialisation) Issue #2306
This commit is contained in:
parent
34d1b60f52
commit
af3c238ce1
@ -186,11 +186,17 @@ void GenodeConsole::handle_input()
|
|||||||
|
|
||||||
/* read out input capabilities of guest */
|
/* read out input capabilities of guest */
|
||||||
bool guest_abs = false, guest_rel = false, guest_multi = false;
|
bool guest_abs = false, guest_rel = false, guest_multi = false;
|
||||||
_vbox_mouse->COMGETTER(AbsoluteSupported)(&guest_abs);
|
if (_vbox_mouse) {
|
||||||
_vbox_mouse->COMGETTER(RelativeSupported)(&guest_rel);
|
_vbox_mouse->COMGETTER(AbsoluteSupported)(&guest_abs);
|
||||||
_vbox_mouse->COMGETTER(MultiTouchSupported)(&guest_multi);
|
_vbox_mouse->COMGETTER(RelativeSupported)(&guest_rel);
|
||||||
|
_vbox_mouse->COMGETTER(MultiTouchSupported)(&guest_multi);
|
||||||
|
}
|
||||||
|
|
||||||
_input.for_each_event([&] (Input::Event const &ev) {
|
_input.for_each_event([&] (Input::Event const &ev) {
|
||||||
|
/* if keyboard/mouse not available, consume input events and drop it */
|
||||||
|
if (!_vbox_keyboard || !_vbox_mouse)
|
||||||
|
return;
|
||||||
|
|
||||||
bool const press = ev.type() == Input::Event::PRESS;
|
bool const press = ev.type() == Input::Event::PRESS;
|
||||||
bool const release = ev.type() == Input::Event::RELEASE;
|
bool const release = ev.type() == Input::Event::RELEASE;
|
||||||
bool const key = press || release;
|
bool const key = press || release;
|
||||||
|
@ -131,11 +131,17 @@ void GenodeConsole::handle_input()
|
|||||||
|
|
||||||
/* read out input capabilities of guest */
|
/* read out input capabilities of guest */
|
||||||
bool guest_abs = false, guest_rel = false, guest_multi = false;
|
bool guest_abs = false, guest_rel = false, guest_multi = false;
|
||||||
_vbox_mouse->COMGETTER(AbsoluteSupported)(&guest_abs);
|
if (_vbox_mouse) {
|
||||||
_vbox_mouse->COMGETTER(RelativeSupported)(&guest_rel);
|
_vbox_mouse->COMGETTER(AbsoluteSupported)(&guest_abs);
|
||||||
_vbox_mouse->COMGETTER(MultiTouchSupported)(&guest_multi);
|
_vbox_mouse->COMGETTER(RelativeSupported)(&guest_rel);
|
||||||
|
_vbox_mouse->COMGETTER(MultiTouchSupported)(&guest_multi);
|
||||||
|
}
|
||||||
|
|
||||||
_input.for_each_event([&] (Input::Event const &ev) {
|
_input.for_each_event([&] (Input::Event const &ev) {
|
||||||
|
/* if keyboard/mouse not available, consume input events and drop it */
|
||||||
|
if (!_vbox_keyboard || !_vbox_mouse)
|
||||||
|
return;
|
||||||
|
|
||||||
bool const press = ev.type() == Input::Event::PRESS;
|
bool const press = ev.type() == Input::Event::PRESS;
|
||||||
bool const release = ev.type() == Input::Event::RELEASE;
|
bool const release = ev.type() == Input::Event::RELEASE;
|
||||||
bool const key = press || release;
|
bool const key = press || release;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user