diff mbox

[v2] Don't crash on keyboard input with no handler

Message ID 528BC3B7.2090205@terremark.com
State New
Headers show

Commit Message

Don Koch Nov. 19, 2013, 8:01 p.m. UTC
Prevent a call to put_kbd if null.

On shutdown of some OSes, the keyboard handler goes away before the
system is down. If a key is typed during this window, qemu crashes.

Signed-off-by: Don Koch <dkoch@verizon.com>
---
v2: punt printf()

 ui/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Tokarev Dec. 2, 2013, 5:18 p.m. UTC | #1
20.11.2013 00:01, Don Koch wrote:
> Prevent a call to put_kbd if null.
> 
> On shutdown of some OSes, the keyboard handler goes away before the
> system is down. If a key is typed during this window, qemu crashes.

Thanks, applied to the trivial patches queue.

/mjt
diff mbox

Patch

diff --git a/ui/input.c b/ui/input.c
index 10d8c05..1c70f60 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -414,7 +414,7 @@  void kbd_put_keycode(int keycode)
     if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
         return;
     }
-    if (entry) {
+    if (entry && entry->put_kbd) {
         entry->put_kbd(entry->opaque, keycode);
     }
 }