static void usbredir_unrealize(USBDevice *udev)
{
    USBRedirDevice *dev = USB_REDIRECT(udev);

    qemu_chr_fe_deinit(&dev->cs, true);

    /* Note must be done after qemu_chr_close, as that causes a close event */
    qemu_bh_delete(dev->chardev_close_bh);
    qemu_bh_delete(dev->device_reject_bh);

    timer_free(dev->attach_timer);

    usbredir_cleanup_device_queues(dev);

    if (dev->parser) {
        usbredirparser_destroy(dev->parser);
    }
    if (dev->watch) {
        g_source_remove(dev->watch);
    }

    free(dev->filter_rules);
    qemu_del_vm_change_state_handler(dev->vmstate);
}
static void usbredir_unrealize(USBDevice *udev)
{
    USBRedirDevice *dev = USB_REDIRECT(udev);

    qemu_chr_fe_deinit(&dev->cs, true);

     
    qemu_bh_delete(dev->chardev_close_bh);
    qemu_bh_delete(dev->device_reject_bh);

    timer_free(dev->attach_timer);

    usbredir_cleanup_device_queues(dev);

    if (dev->parser) {
        usbredirparser_destroy(dev->parser);
    }
    if (dev->watch) {
        g_source_remove(dev->watch);
    }

    free(dev->filter_rules);
    qemu_del_vm_change_state_handler(dev->vmstate);
}