void QHiMDWinDetection::remove_himddevice(QString path)
{
    int index = -1;
    QHiMDDevice * dev = static_cast<QHiMDDevice *>(find_by_path(path));

    if (!dev)
        return;

    index = dlist.indexOf(dev);

    if(dev->isOpen())
        dev->close();

    if(dev->name() != "disc image")
    {
        if(dev->MdChange() != NULL)
            unregister_mediaChange((HDEVNOTIFY)dev->MdChange());
        if(dev->deviceHandle() != NULL)
             CloseHandle(dev->deviceHandle());
     }

    delete dev;
    dev = NULL;

    dlist.removeAt(index);

    emit deviceListChanged(dlist);
}
示例#2
0
void QHiMDDetection::remove_himddevice(QString path)
{
    QHiMDDevice * dev = static_cast<QHiMDDevice *>(find_by_path(path));
    int i = dlist.indexOf(find_by_path(path));

    if(i < 0)
        return;

    if(dev->isOpen())
        dev->close();
    delete dev;
    dev = NULL;

    dlist.removeAt(i);
}