OK, thank you Paolo! I will write a char_unparent as your comment.
Wind Yu ------------------ ???????? ------------------ ??????: "Paolo Bonzini" <pbonz...@redhat.com>; ????????: 2021??11??19??(??????) ????5:27 ??????: "Marc-Andr?? Lureau"<marcandre.lur...@redhat.com>;"????????????"<787738...@qq.com>; ????: "qemu-devel"<qemu-devel@nongnu.org>; ????: Re: Chardev: delete the QemuOpts reserved in vm_config_groups On 11/8/21 09:46, Marc-Andr?? Lureau wrote: >> + QemuOpts *opts; >> >> chr = qemu_chr_find(id); >> if (chr == NULL) { >> @@ -1175,6 +1177,10 @@ void qmp_chardev_remove(const char *id, Error **errp) >> return; >> } >> object_unparent(OBJECT(chr)); >> + /* delete the opts reserved in vm_config_groups list. */ >> + opts = qemu_opts_find(qemu_find_opts("chardev"), id); >> + if (opts) >> + qemu_opts_del(opts); > That seems reasonable to me, > Reviewed-by: Marc-Andr?? Lureau<marcandre.lur...@redhat.com> I think it should be done instead in an unparent function, i.e. with something like "oc->unparent = chr_unparent;" in char_class_init. chr_unparent does the qemu_opts_find/qemu_opts_del. Thanks, Paolo