OK, thank you Paolo! I will write a char_unparent as your comment.


Wind Yu




------------------ ???????? ------------------
??????:                                                                         
                                               "Paolo Bonzini"                  
                                                                  
<pbonz...@redhat.com&gt;;
????????:&nbsp;2021??11??19??(??????) ????5:27
??????:&nbsp;"Marc-Andr?? 
Lureau"<marcandre.lur...@redhat.com&gt;;"????????????"<787738...@qq.com&gt;;
????:&nbsp;"qemu-devel"<qemu-devel@nongnu.org&gt;;
????:&nbsp;Re: Chardev: delete the QemuOpts reserved in vm_config_groups



On 11/8/21 09:46, Marc-Andr?? Lureau wrote:
&gt;&gt; +&nbsp;&nbsp; QemuOpts *opts;
&gt;&gt;
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chr = qemu_chr_find(id);
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (chr == NULL) {
&gt;&gt; @@ -1175,6 +1177,10 @@ void qmp_chardev_remove(const char *id, Error 
**errp)
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object_unparent(OBJECT(chr));
&gt;&gt; +&nbsp;&nbsp;&nbsp; /* delete the opts reserved in vm_config_groups 
list.&nbsp; */
&gt;&gt; +&nbsp;&nbsp;&nbsp; opts = qemu_opts_find(qemu_find_opts("chardev"), 
id);
&gt;&gt; +&nbsp;&nbsp;&nbsp; if (opts)
&gt;&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qemu_opts_del(opts);
&gt; That seems reasonable to me,
&gt; Reviewed-by: Marc-Andr?? Lureau<marcandre.lur...@redhat.com&gt;

I think it should be done instead in an unparent function, i.e. with 
something like "oc-&gt;unparent = chr_unparent;" in char_class_init. 
chr_unparent does the qemu_opts_find/qemu_opts_del.

Thanks,

Paolo

Reply via email to