From patchwork Fri Nov 21 09:25:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 412976 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E634D140186 for ; Fri, 21 Nov 2014 20:26:12 +1100 (AEDT) Received: from localhost ([::1]:39436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrkTi-0005sz-K1 for incoming@patchwork.ozlabs.org; Fri, 21 Nov 2014 04:26:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrkT3-0005FB-Lv for qemu-devel@nongnu.org; Fri, 21 Nov 2014 04:25:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrkSw-0003D9-G4 for qemu-devel@nongnu.org; Fri, 21 Nov 2014 04:25:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrkSw-0003Cr-9U for qemu-devel@nongnu.org; Fri, 21 Nov 2014 04:25:22 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAL9PKsl004065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 21 Nov 2014 04:25:20 -0500 Received: from nilsson.home.kraxel.org (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAL9PJdM006219; Fri, 21 Nov 2014 04:25:19 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 6BC43826DC; Fri, 21 Nov 2014 10:25:18 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 21 Nov 2014 10:25:12 +0100 Message-Id: <1416561912-8877-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1416561912-8877-1-git-send-email-kraxel@redhat.com> References: <1416561912-8877-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Fam Zheng , Gerd Hoffmann , Anthony Liguori Subject: [Qemu-devel] [PULL for-2.2 2/2] gtk: Don't crash if -nodefaults 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: Fam Zheng This fixes a crash by just skipping the vte resize hack if cur is NULL. Reproducer: qemu-system-x86_64 -nodefaults Signed-off-by: Fam Zheng Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 9496b8d..0385757 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1909,15 +1909,17 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) #ifdef VTE_RESIZE_HACK { VirtualConsole *cur = gd_vc_find_current(s); - int i; - - for (i = 0; i < s->nb_vcs; i++) { - VirtualConsole *vc = &s->vc[i]; - if (vc && vc->type == GD_VC_VTE && vc != cur) { - gtk_widget_hide(vc->vte.terminal); + if (cur) { + int i; + + for (i = 0; i < s->nb_vcs; i++) { + VirtualConsole *vc = &s->vc[i]; + if (vc && vc->type == GD_VC_VTE && vc != cur) { + gtk_widget_hide(vc->vte.terminal); + } } + gd_update_windowsize(cur); } - gd_update_windowsize(cur); } #endif