VirtualBox

Changeset 24560 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Nov 10, 2009 4:44:42 PM (15 years ago)
Author:
vboxsync
Message:

Main/MachineImpl: change the dvd/floppy mounting code so that the backref info is updated immediately, including corresponding rollback handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r24539 r24560  
    28322832    Guid id(aId);
    28332833    ComObjPtr<Medium> medium;
    2834     switch (pAttach->type())
     2834    DeviceType_T mediumType = pAttach->type();
     2835    switch (mediumType)
    28352836    {
    28362837        case DeviceType_DVD:
     
    29012902                                 aDevice);
    29022903        AutoWriteLock attLock(pAttach);
     2904        /* For non-hard disk media, detach straight away. */
     2905        if (mediumType != DeviceType_HardDisk && !oldmedium.isNull())
     2906            oldmedium->detachFrom(mData->mUuid);
    29032907        if (!medium.isNull())
    29042908            medium->attachTo(mData->mUuid);
     
    29232927            return rc;
    29242928        AutoWriteLock attLock(pAttach);
     2929        /* For non-hard disk media, re-attach straight away. */
     2930        if (mediumType != DeviceType_HardDisk && !oldmedium.isNull())
     2931            oldmedium->attachTo(mData->mUuid);
    29252932        pAttach->updateMedium(oldmedium, false /* aImplicit */);
    29262933    }
     
    39403947    int rc = SSMR3Open(pStateFilePath->raw(), 0 /*fFlags*/, &pSSM);
    39413948    if (RT_SUCCESS(rc))
    3942     { 
     3949    {
    39433950        uint32_t uVersion;
    39443951        rc = SSMR3Seek(pSSM, "DisplayScreenshot", 1100 /*iInstance*/, &uVersion);
     
    77067713        {
    77077714            MediumAttachment *pAttach = *it;
    7708 
    77097715            Medium* pMedium = pAttach->medium();
    77107716
    7711             if (pMedium)
     7717            /* Detach only hard disks, since DVD/floppy media is detached
     7718             * instantly in MountMedium. */
     7719            if (pAttach->type() == DeviceType_HardDisk && pMedium)
    77127720            {
    77137721                LogFlowThisFunc(("detaching medium '%s' from machine\n", pMedium->name().raw()));
     
    77457753             ++it)
    77467754        {
     7755            MediumAttachment *pAttach = *it;
     7756            /* Fix up the backrefs for DVD/floppy media. */
     7757            if (pAttach->type() != DeviceType_HardDisk)
     7758            {
     7759                Medium* pMedium = pAttach->medium();
     7760                if (pMedium)
     7761                {
     7762                    rc = pMedium->detachFrom(mData->mUuid);
     7763                    AssertComRC(rc);
     7764                }
     7765            }
     7766
    77477767            (*it)->rollback();
     7768
     7769            pAttach = *it;
     7770            /* Fix up the backrefs for DVD/floppy media. */
     7771            if (pAttach->type() != DeviceType_HardDisk)
     7772            {
     7773                Medium* pMedium = pAttach->medium();
     7774                if (pMedium)
     7775                {
     7776                    rc = pMedium->attachTo(mData->mUuid);
     7777                    AssertComRC(rc);
     7778                }
     7779            }
    77487780        }
    77497781
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette