mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
vnc: deal with surface NULL pointers
Secondary displays in multihead setups are allowed to have a NULL DisplaySurface. Typically user interfaces handle this by hiding the window which shows the display in question. This isn't an option for vnc though because it simply hasn't a concept of windows or outputs. So handle the situation by showing a placeholder DisplaySurface instead. Also check in console_select whenever a surface is preset in the first place before requesting an update. This fixes a segfault which can be triggered by switching to an unused display (via vtrl-alt-<nr>) in a multihead setup, for example using -device virtio-vga,max_outputs=2. Cc: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 20180308161803.6152-1-kraxel@redhat.com
This commit is contained in:
parent
f1bd313264
commit
2e5567c903
3 changed files with 18 additions and 4 deletions
10
ui/vnc.c
10
ui/vnc.c
|
@ -746,9 +746,19 @@ static void vnc_update_server_surface(VncDisplay *vd)
|
|||
static void vnc_dpy_switch(DisplayChangeListener *dcl,
|
||||
DisplaySurface *surface)
|
||||
{
|
||||
static const char placeholder_msg[] =
|
||||
"Display output is not active.";
|
||||
static DisplaySurface *placeholder;
|
||||
VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
|
||||
VncState *vs;
|
||||
|
||||
if (surface == NULL) {
|
||||
if (placeholder == NULL) {
|
||||
placeholder = qemu_create_message_surface(640, 480, placeholder_msg);
|
||||
}
|
||||
surface = placeholder;
|
||||
}
|
||||
|
||||
vnc_abort_display_jobs(vd);
|
||||
vd->ds = surface;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue