VirtualBox

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


Ignore:
Timestamp:
Oct 14, 2009 2:39:02 PM (15 years ago)
Author:
vboxsync
Message:

Main/MachineImpl: fix medium backref handling for floppy/dvd media

File:
1 edited

Legend:

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

    r23750 r23763  
    24532453                        aDevice, aControllerPort, aControllerName);
    24542454
    2455     ComObjPtr<Medium> hd = pAttach->medium();
    24562455
    24572456    if (pAttach->isImplicit())
     
    24722471        alock.leave();
    24732472
     2473        ComObjPtr<Medium> hd = pAttach->medium();
    24742474        rc = hd->deleteStorageAndWait();
    24752475
     
    25782578    if (SUCCEEDED(rc))
    25792579    {
     2580
     2581        mMediaData.backup();
     2582        /* The backup operation makes the pAttach reference point to the
     2583         * old settings. Re-get the correct reference. */
     2584        pAttach = findAttachment(mMediaData->mAttachments,
     2585                                 aControllerName,
     2586                                 aControllerPort,
     2587                                 aDevice);
    25802588        AutoWriteLock attLock(pAttach);
     2589        if (!medium.isNull())
     2590            medium->attachTo(mData->mUuid);
    25812591        pAttach->updateMedium(medium, false /* aImplicit */);
    25822592    }
     
    55735583        CheckComRCBreakRC(rc);
    55745584
    5575         if (dev.deviceType == DeviceType_HardDisk)
    5576         {
    5577             /* associate the hard disk with this machine and snapshot */
    5578             if (mType == IsSnapshotMachine)
    5579                 rc = medium->attachTo(mData->mUuid, *aSnapshotId);
    5580             else
    5581                 rc = medium->attachTo(mData->mUuid);
    5582             AssertComRCBreakRC (rc);
    5583         }
     5585        /* associate the medium with this machine and snapshot */
     5586        if (mType == IsSnapshotMachine)
     5587            rc = medium->attachTo(mData->mUuid, *aSnapshotId);
     5588        else
     5589            rc = medium->attachTo(mData->mUuid);
     5590        AssertComRCBreakRC (rc);
    55845591
    55855592        /* backup mMediaData to let registeredInit() properly rollback on failure
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