From patchwork Fri Dec 6 19:15:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 298219 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5B6DA2C00A8 for ; Sat, 7 Dec 2013 06:23:31 +1100 (EST) Received: from localhost ([::1]:33099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp0zo-0007qV-OP for incoming@patchwork.ozlabs.org; Fri, 06 Dec 2013 14:23:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp0zF-0007nv-L3 for qemu-devel@nongnu.org; Fri, 06 Dec 2013 14:22:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vp0zB-0008B3-H0 for qemu-devel@nongnu.org; Fri, 06 Dec 2013 14:22:53 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:41185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp0zB-0008An-9V; Fri, 06 Dec 2013 14:22:49 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id CC9FC40DD3; Fri, 6 Dec 2013 23:22:47 +0400 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 7E4B0607; Fri, 6 Dec 2013 23:15:45 +0400 (MSK) Received: (nullmailer pid 19234 invoked by uid 1000); Fri, 06 Dec 2013 19:15:44 -0000 From: Michael Tokarev To: aliguori@amazon.com Date: Fri, 6 Dec 2013 23:15:39 +0400 Message-Id: <1386357341-19147-13-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386357341-19147-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1386357341-19147-1-git-send-email-mjt@msgid.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Michael Tokarev , qemu-devel@nongnu.org, Don Koch Subject: [Qemu-devel] [PULL 12/14] Don't crash on keyboard input with no handler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Don Koch 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 Signed-off-by: Michael Tokarev --- ui/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } }