Received: from eggs.gnu.org ([2001:4830:134:3::10]:60760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b84NS-0002ir-1s for qemu-devel@nongnu.org; Wed, 01 Jun 2016 07:32:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b84NN-0004SW-5n for qemu-devel@nongnu.org; Wed, 01 Jun 2016 07:31:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b84NM-0004SD-W2 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 07:31:53 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 77A0C7F0AD for ; Wed, 1 Jun 2016 11:31:52 +0000 (UTC) References: <2e555d67b7e53a86bef98f774a2706f2b0ec4ea0.1464728215.git.crobinso@redhat.com> <1464763097.8823.13.camel@redhat.com> From: Cole Robinson Message-ID: <2434cfba-cbc2-3b57-f326-b40e89add3e4@redhat.com> Date: Wed, 1 Jun 2016 07:31:51 -0400 MIME-Version: 1.0 In-Reply-To: <1464763097.8823.13.camel@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: Gerd Hoffmann Cc: qemu-devel@nongnu.org On 06/01/2016 02:38 AM, Gerd Hoffmann wrote: > 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) >> >> 0 0x00005555559631af in sdl_display_init (ds=, full_screen=0, no_frame=) at ui/sdl2.c:822 >> 1 0x00005555556c8a9a in main (argc=, argv=, envp=) at vl.c:4527 >> >> 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 = i; > + if (sdl2_num_outputs == 0) { > + return; > + } > sdl2_console = g_new0(struct sdl2_console, sdl2_num_outputs); > for (i = 0; i < sdl2_num_outputs; i++) { > QemuConsole *con = 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. > Works for me, I figured there was a better approach to handle -sdl + no display device. If you send a patch I'll test it Thanks, Cole