From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viq0k-0003Ia-Ge for qemu-devel@nongnu.org; Tue, 19 Nov 2013 13:27:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Viq0e-0004is-Fc for qemu-devel@nongnu.org; Tue, 19 Nov 2013 13:26:54 -0500 Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:46448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viq0e-0004ig-92 for qemu-devel@nongnu.org; Tue, 19 Nov 2013 13:26:48 -0500 From: Don Koch Message-ID: <528BAD62.8090103@terremark.com> Date: Tue, 19 Nov 2013 13:26:42 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] Don't crash on keyboard input with no handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Anthony Liguori 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 --- I left the printf call, originally for testing, but useful as a sanity check if the user wonders why his keyboard input was ignored. AFAIC, it can be removed. PS: Anthony, your address in the MAINTAINER file is still at ibm. I assume that is no longer correct, yes? ui/input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/input.c b/ui/input.c index 92c44ca..28ef6a6 100644 --- a/ui/input.c +++ b/ui/input.c @@ -415,8 +415,10 @@ void kbd_put_keycode(int keycode) return; } if (entry) { - entry->put_kbd(entry->opaque, keycode); + if (entry->put_kbd) + entry->put_kbd(entry->opaque, keycode); + else + printf("%s: no keyboard handler\n", __FUNCTION__); } } -- 1.8.1.4