qemu/ui
Thomas Huth d3f77be407 ui/vnc: Fix crash when specifying [vnc] without id in the config file
QEMU currently crashes when there is a [vnc] section in the config
file that does not have an "id = ..." line:

 $ echo "[vnc]" > /tmp/qemu.conf
 $ ./qemu-system-x86_64 -readconfig /tmp/qemu.conf
 qemu-system-x86_64: ../../devel/qemu/ui/vnc.c:4347: vnc_init_func:
  Assertion `id' failed.
 Aborted (core dumped)

The required "id" is only set up automatically while parsing the command
line, but not when reading the options from the config file.
Thus let's move code that automatically adds the id (if it does not
exist yet) to the init function that needs the id for the first time,
replacing the assert() statement there.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2836
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250821145130.845104-1-thuth@redhat.com>
(cherry picked from commit 38dd513263)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-09-11 17:23:11 +03:00
..
icons configure: move directory options from config-host.mak to meson 2020-10-26 07:08:38 -04:00
shader meson: do not build shaders by default 2023-10-17 15:20:53 +02:00
clipboard.c ui/vdagent: notify clipboard peers of serial reset 2024-07-22 12:47:28 +04:00
cocoa.m ui & main loop: Redesign of system-specific main thread event handling 2024-12-31 21:21:34 +01:00
console-gl.c ui/console: remove redundant format field 2023-09-12 10:37:02 +04:00
console-priv.h ui/curses: Do not use console_select() 2024-03-20 10:27:58 +04:00
console-vc-stubs.c ui/curses: Do not use console_select() 2024-03-20 10:27:58 +04:00
console-vc.c ui/console-vc: implement DCH (delete) and ICH (insert) commands 2025-03-05 09:34:14 +04:00
console.c overall: Remove unnecessary g_strdup_printf() calls 2025-02-14 08:49:06 +03:00
curses_keys.h For curses display, recognize a few more control keys 2023-07-25 10:56:51 +01:00
curses.c ui/curses: Fix infinite loop on windows 2025-08-10 09:01:04 +03:00
cursor_hidden.xpm
cursor_left_ptr.xpm
cursor.c ui/cursor: remove cursor_get_mono_image 2024-10-03 17:26:06 +03:00
dbus-chardev.c qom: Use object_get_container() 2025-01-09 18:16:24 +01:00
dbus-clipboard.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
dbus-console.c ui/dbus: on win32, allow ANONYMOUS with p2p 2025-02-03 21:15:57 +04:00
dbus-display1.xml dbus: add -audio dbus nsamples option 2025-02-03 21:16:07 +04:00
dbus-error.c ui: add a D-Bus display backend 2021-12-21 10:50:22 +04:00
dbus-listener.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
dbus-module.c ui/dbus: add p2p=on/off option 2021-12-21 10:50:22 +04:00
dbus.c ui/dbus: on win32, allow ANONYMOUS with p2p 2025-02-03 21:15:57 +04:00
dbus.h ui/dbus: win32 support 2023-06-27 17:08:56 +02:00
dmabuf.c ui/console: move QemuDmaBuf struct def to dmabuf.c 2024-05-14 17:14:12 +04:00
egl-context.c qapi/ui: Drop temporary 'prefix' 2024-09-10 13:22:47 +02:00
egl-headless.c qapi/ui: Drop temporary 'prefix' 2024-09-10 13:22:47 +02:00
egl-helpers.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
gtk-clipboard.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
gtk-egl.c ui/gtk: Use consistent naming for variables in different coordinates 2025-05-30 13:52:01 +03:00
gtk-gl-area.c ui/gtk: Update scales in fixed-scale mode when rendering GL area 2025-05-30 13:52:01 +03:00
gtk.c gtk/ui: Introduce helper gd_update_scale 2025-05-30 13:52:01 +03:00
input-barrier.c vfio scsi ui: Error-check qio_channel_socket_connect_sync() the same way 2025-09-03 11:05:08 +03:00
input-barrier.h ui: add an embedded Barrier client 2019-09-17 13:43:22 +02:00
input-keymap.c meson: rename included C source files to .c.inc 2020-08-21 06:18:30 -04:00
input-legacy.c ui/input-legacy.c: remove unused legacy qemu_add_kbd_event_handler() function 2024-11-08 11:06:42 +01:00
input-linux.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
input.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
kbd-state.c ui/vnc: Do not use console_select() 2024-03-20 10:27:54 +04:00
keymaps.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
keymaps.h ui: spelling fixes 2023-08-31 19:47:43 +02:00
meson.build ui/sdl2: reenable the SDL2 Windows keyboard hook procedure 2025-02-13 13:50:45 +01:00
qemu-pixman.c ui/vnc: take account of client byte order in pixman format 2025-05-30 15:26:28 +03:00
qemu-x509.h
qemu.desktop ui: fix icon display for GTK frontend under GNOME Shell with Wayland 2019-01-21 09:43:13 +01:00
sdl2-2d.c ui+display: rename is_placeholder() -> surface_is_placeholder() 2024-06-19 12:42:03 +02:00
sdl2-gl.c qapi/ui: Drop temporary 'prefix' 2024-09-10 13:22:47 +02:00
sdl2-input.c ui/sdl2: release all modifiers 2024-09-13 20:12:16 +02:00
sdl2.c ui/sdl: Consider scaling in mouse event handling 2025-05-30 13:52:01 +03:00
shader.c ui/shader: free associated programs 2022-03-14 15:16:16 +04:00
spice-app.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
spice-core.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
spice-display.c ui/console: Convert mouse visibility parameter into bool 2024-07-16 20:04:08 +02:00
spice-input.c input: Allow to choose console with qemu_input_is_absolute 2023-10-03 15:04:56 +04:00
spice-module.c spice: wire up monitor in QemuSpiceOps. 2020-10-21 15:46:14 +02:00
trace-events ui/dbus: add trace for can_share_map 2024-10-14 17:34:09 +04:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
udmabuf.c Do not include "qemu/error-report.h" in headers that do not need it 2023-02-14 09:11:27 +01:00
ui-hmp-cmds.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
ui-qmp-cmds.c ui/qmp-cmds: Improve two error messages 2023-11-17 10:07:52 +01:00
util.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
vdagent.c ui/vdagent: send caps on fe_open 2024-07-22 12:47:28 +04:00
vgafont.h ui: fix tab indentation 2022-11-08 10:23:06 +01:00
vnc_keysym.h ui: fix tab indentation 2022-11-08 10:23:06 +01:00
vnc-auth-sasl.c ui: validate NUL byte padding in SASL client data more strictly 2024-10-22 13:02:31 +01:00
vnc-auth-sasl.h vnc: avoid deprecation warnings for SASL on OS X 2021-06-15 17:17:09 +02:00
vnc-auth-vencrypt.c vnc: fix resource leak when websocket channel error 2020-11-04 08:25:17 +01:00
vnc-auth-vencrypt.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
vnc-clipboard.c ui/vnc-clipboard: fix inflate_buffer 2023-12-04 11:28:26 +04:00
vnc-enc-hextile-template.h ui/vnc-enc-hextile: Use static rather than dynamic length stack array 2023-09-04 14:57:44 +04:00
vnc-enc-hextile.c Drop useless casts from g_malloc() & friends to pointer 2022-10-22 23:15:40 +02:00
vnc-enc-tight.c ui/vnc: fix tight palette pixel encoding for 8/16-bpp formats 2025-05-30 15:26:28 +03:00
vnc-enc-tight.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
vnc-enc-zlib.c ui/vnc: Do not copy z_stream 2025-07-17 06:57:23 +03:00
vnc-enc-zrle.c ui/vnc.c: replace big endian flag with byte order value 2025-05-30 15:26:28 +03:00
vnc-enc-zrle.c.inc ui: Clean up local variable shadowing 2023-09-29 08:13:57 +02:00
vnc-enc-zrle.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
vnc-enc-zywrle-template.c ui: fix tab indentation 2022-11-08 10:23:06 +01:00
vnc-enc-zywrle.h ui: spelling fixes 2023-08-31 19:47:43 +02:00
vnc-jobs.c ui/vnc.c: replace big endian flag with byte order value 2025-05-30 15:26:28 +03:00
vnc-jobs.h ui/vnc: Drop unused vnc_has_job() and vnc_jobs_clear() 2017-02-08 14:59:36 +01:00
vnc-palette.c ui: Clean up local variable shadowing 2023-09-29 08:13:57 +02:00
vnc-palette.h Include qapi/qmp/qlist.h exactly where needed 2018-02-09 13:52:15 +01:00
vnc-stubs.c qemu-options: define -vnc only #ifdef CONFIG_VNC 2023-11-07 14:04:25 +04:00
vnc-ws.c bulk: Remove pointless QOM casts 2023-06-05 20:48:34 +02:00
vnc-ws.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
vnc.c ui/vnc: Fix crash when specifying [vnc] without id in the config file 2025-09-11 17:23:11 +03:00
vnc.h ui/vnc: Do not copy z_stream 2025-07-17 06:57:23 +03:00
win32-kbd-hook.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
x_keymap.c ui: Fix memory leak in qemu_xkeymap_mapping_table() 2021-05-02 17:24:50 +02:00
x_keymap.h ui: convert GTK and SDL1 frontends to keycodemapdb 2018-01-25 15:02:00 +01:00