qemu-e2k/chardev
Lukas Straub feb774ca3f chardev: Fix yank with the chardev-change case
When changing from chardev-socket (which supports yank) to
chardev-socket again, it fails, because the new chardev attempts
to register a new yank instance. This in turn fails, as there
still is the yank instance from the current chardev. Also,
the old chardev shouldn't unregister the yank instance when it
is freed.

To fix this, now the new chardev only registers a yank instance if
the current chardev doesn't support yank and thus hasn't registered
one already. Also, when the old chardev is freed, it now only
unregisters the yank instance if the new chardev doesn't need it.

If the initialization of the new chardev fails, it still has
chr->handover_yank_instance set and won't unregister the yank
instance when it is freed.

s->registered_yank is always true here, as chardev-change only works
on user-visible chardevs and those are guraranteed to register a
yank instance as they are initialized via
chardev_new()
 qemu_char_open()
  cc->open() (qmp_chardev_open_socket()).

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Li Zhang <li.zhang@cloud.ionos.com>
Message-Id: <9637888d7591d2971975188478bb707299a1dc04.1617127849.git.lukasstraub2@web.de>
2021-04-01 15:27:44 +04:00
..
baum.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
char-console.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
char-fd.c util: rename qemu_open() to qemu_open_old() 2020-09-16 10:33:48 +01:00
char-fe.c chardev: Reduce "char-mux.h" scope, rename it "chardev-internal.h" 2020-07-13 11:59:47 +04:00
char-file.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
char-io.c chardev: use a child source for qio input source 2018-10-03 14:45:05 +04:00
char-mux.c chardev: do not use machine_init_done 2020-12-15 12:51:51 -05:00
char-null.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
char-parallel.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
char-pipe.c util: rename qemu_open() to qemu_open_old() 2020-09-16 10:33:48 +01:00
char-pty.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
char-ringbuf.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
char-serial.c chardev: Add macOS to list of OSes that support -chardev serial 2020-05-04 14:35:23 +02:00
char-socket.c chardev: Fix yank with the chardev-change case 2021-04-01 15:27:44 +04:00
char-stdio.c char-stdio: Fix QMP default for 'signal' 2020-11-17 12:26:47 +01:00
char-udp.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
char-win-stdio.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
char-win.c chardev: Improve error report by calling error_setg_win32() 2020-03-09 13:36:15 +01:00
char.c chardev: Fix yank with the chardev-change case 2021-04-01 15:27:44 +04:00
chardev-internal.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
meson.build brlapi: convert to meson 2021-01-02 21:03:37 +01:00
msmouse.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
spice.c spice: move add_interface() to QemuSpiceOps. 2020-10-21 15:46:14 +02:00
testdev.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
trace-events trace-events: Shorten file names in comments 2019-03-22 16:18:07 +00:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
wctablet.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00