qemu-e2k/include/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
..
char-fd.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
char-fe.h chardev: Use QEMUChrEvent enum in IOEventHandler typedef 2020-01-08 11:15:35 +01:00
char-io.h Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
char-parallel.h
char-serial.h
char-win-stdio.h
char-win.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
char.h chardev: Fix yank with the chardev-change case 2021-04-01 15:27:44 +04:00
spice.h chardev/spice: simplify chardev setup 2020-10-15 11:14:40 +02:00