diff options
Diffstat (limited to 'chardev')
-rw-r--r-- | chardev/char-fe.c | 5 | ||||
-rw-r--r-- | chardev/char-mux.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/chardev/char-fe.c b/chardev/char-fe.c index 341221d029..3f90f0567c 100644 --- a/chardev/char-fe.c +++ b/chardev/char-fe.c @@ -211,7 +211,7 @@ unavailable: return false; } -void qemu_chr_fe_deinit(CharBackend *b) +void qemu_chr_fe_deinit(CharBackend *b, bool del) { assert(b); @@ -224,6 +224,9 @@ void qemu_chr_fe_deinit(CharBackend *b) MuxChardev *d = MUX_CHARDEV(b->chr); d->backends[b->tag] = NULL; } + if (del) { + object_unparent(OBJECT(b->chr)); + } b->chr = NULL; } } diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 106c682e7f..08570b915e 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -266,7 +266,7 @@ static void char_mux_finalize(Object *obj) be->chr = NULL; } } - qemu_chr_fe_deinit(&d->chr); + qemu_chr_fe_deinit(&d->chr, false); } void mux_chr_set_handlers(Chardev *chr, GMainContext *context) |