From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7znL-0003eu-W6 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 02:38:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7znH-0007T0-RT for qemu-devel@nongnu.org; Wed, 01 Jun 2016 02:38:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7znH-0007Sw-MF for qemu-devel@nongnu.org; Wed, 01 Jun 2016 02:38:19 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 206A47F084 for ; Wed, 1 Jun 2016 06:38:19 +0000 (UTC) Message-ID: <1464763097.8823.13.camel@redhat.com> From: Gerd Hoffmann Date: Wed, 01 Jun 2016 08:38:17 +0200 In-Reply-To: <2e555d67b7e53a86bef98f774a2706f2b0ec4ea0.1464728215.git.crobinso@redhat.com> References: <2e555d67b7e53a86bef98f774a2706f2b0ec4ea0.1464728215.git.crobinso@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] ui: sdl2: Fix crash with -nodefaults -sdl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cole Robinson Cc: qemu-devel@nongnu.org On Di, 2016-05-31 at 16:56 -0400, Cole Robinson wrote: > $ ./x86_64-softmmu/qemu-system-x86_64 -nodefaults -sdl > Segmentation fault (core dumped) >=20 > 0 0x00005555559631af in sdl_display_init (ds=3D, full_scr= een=3D0, no_frame=3D) at ui/sdl2.c:822 > 1 0x00005555556c8a9a in main (argc=3D, argv=3D, envp=3D) at vl.c:4527 >=20 > Setting the window icon assumes there's always an SDL output window > available, which isn't the case with when there's no video device, > like via -nodefaults. So don't try to set a window icon when we don't > have any outputs. Hmm, I guess we can skip pretty much all of the init in case there are no outputs: @@ -794,6 +794,9 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) } } sdl2_num_outputs =3D i; + if (sdl2_num_outputs =3D=3D 0) { + return; + } sdl2_console =3D g_new0(struct sdl2_console, sdl2_num_outputs); for (i =3D 0; i < sdl2_num_outputs; i++) { QemuConsole *con =3D qemu_console_lookup_by_index(i); Maybe even move up the loop counting the outputs, so we can skip the SDL_Init() call too. We don't get a empty window then. cheers, Gerd