qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ui: sdl2: Fix crash with -nodefaults -sdl


From: Cole Robinson
Subject: Re: [Qemu-devel] [PATCH] ui: sdl2: Fix crash with -nodefaults -sdl
Date: Wed, 1 Jun 2016 07:31:51 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

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=<optimized out>, 
>> full_screen=0, no_frame=<optimized out>) at ui/sdl2.c:822
>> 1  0x00005555556c8a9a in main (argc=<optimized out>, argv=<optimized out>, 
>> envp=<optimized out>) 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]