static int win_chr_poll(void *opaque);
static int win_chr_pipe_poll(void *opaque);
-static void win_chr_free(Chardev *chr)
+static void char_win_finalize(Object *obj)
{
+ Chardev *chr = CHARDEV(obj);
WinChardev *s = WIN_CHARDEV(chr);
if (s->skip_free) {
if (s->hsend) {
CloseHandle(s->hsend);
- s->hsend = NULL;
}
if (s->hrecv) {
CloseHandle(s->hrecv);
- s->hrecv = NULL;
}
if (s->hcom) {
CloseHandle(s->hcom);
- s->hcom = NULL;
}
if (s->fpipe)
qemu_del_polling_cb(win_chr_pipe_poll, chr);
return 0;
fail:
- win_chr_free(chr);
return -1;
}
return 0;
fail:
- win_chr_free(chr);
return -1;
}
ChardevClass *cc = CHARDEV_CLASS(oc);
cc->chr_write = win_chr_write;
- cc->chr_free = win_chr_free;
}
static const TypeInfo char_win_type_info = {
.name = TYPE_CHARDEV_WIN,
.parent = TYPE_CHARDEV,
.instance_size = sizeof(WinChardev),
+ .instance_finalize = char_win_finalize,
.class_init = char_win_class_init,
.abstract = true,
};