VirtualBox

Changeset 23591 in vbox


Ignore:
Timestamp:
Oct 7, 2009 7:57:15 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53257
Message:

Main/MediumImpl: fix closing of DVD/floppy media.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

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

    r23451 r23591  
    9595          accessibleInLock(false),
    9696          type(MediumType_Normal),
     97          devType(DeviceType_HardDisk),
    9798          logicalSize(0),
    9899          hddOpenMode(OpenReadWrite),
     
    128129
    129130    MediumType_T type;
     131    DeviceType_T devType;
    130132    uint64_t logicalSize;   /*< In MBytes. */
    131133
     
    10471049 * @param aVirtualBox   VirtualBox object.
    10481050 * @param aParent       Parent medium disk or NULL for a root (base) medium.
    1049  * @param aType         Device type of the medium.
     1051 * @param aDeviceType   Device type of the medium.
    10501052 * @param aNode         Configuration settings.
    10511053 *
     
    10541056HRESULT Medium::init(VirtualBox *aVirtualBox,
    10551057                     Medium *aParent,
    1056                      DeviceType_T aType,
     1058                     DeviceType_T aDeviceType,
    10571059                     const settings::Medium &data)
    10581060{
     
    10981100
    10991101    /* required */
    1100     if (aType == DeviceType_HardDisk)
     1102    if (aDeviceType == DeviceType_HardDisk)
    11011103    {
    11021104        AssertReturn(!data.strFormat.isEmpty(), E_FAIL);
     
    11371139    CheckComRCReturnRC(rc);
    11381140
    1139     if (aType == DeviceType_HardDisk)
     1141    if (aDeviceType == DeviceType_HardDisk)
    11401142    {
    11411143        /* type is only for base hard disks */
     
    11451147    else
    11461148        m->type = MediumType_Writethrough;
     1149
     1150    /* remember device type for correct unregistering later */
     1151    m->devType = aDeviceType;
    11471152
    11481153    LogFlowThisFunc(("m->locationFull='%ls', m->format=%ls, m->id={%RTuuid}\n",
     
    11661171        rc = pHD->init(aVirtualBox,
    11671172                       this,            // parent
    1168                        aType,
     1173                       aDeviceType,
    11691174                       m);              // child data
    11701175        CheckComRCBreakRC(rc);
     
    11901195 *
    11911196 * @param aVirtualBox   VirtualBox object.
    1192  * @param aType         Device type of the medium.
     1197 * @param aDeviceType   Device type of the medium.
    11931198 * @param aLocation     Location of the host drive.
    11941199 * @param aDescription  Comment for this host drive.
     
    11971202 */
    11981203HRESULT Medium::init(VirtualBox *aVirtualBox,
    1199                      DeviceType_T aType,
     1204                     DeviceType_T aDeviceType,
    12001205                     CBSTR aLocation,
    12011206                     CBSTR aDescription)
    12021207{
    1203     ComAssertRet(aType == DeviceType_DVD || aType == DeviceType_Floppy, E_INVALIDARG);
     1208    ComAssertRet(aDeviceType == DeviceType_DVD || aDeviceType == DeviceType_Floppy, E_INVALIDARG);
    12041209    ComAssertRet(aLocation, E_INVALIDARG);
    12051210
     
    12151220    RTUUID uuid;
    12161221    RTUuidClear(&uuid);
    1217     if (aType == DeviceType_DVD)
     1222    if (aDeviceType == DeviceType_DVD)
    12181223        memcpy(&uuid.au8[0], "DVD", 3);
    12191224    else
     
    12291234
    12301235    m->type = MediumType_Writethrough;
     1236    m->devType = aDeviceType;
    12311237    m->state = MediumState_Created;
    12321238    m->hostDrive = true;
     
    46904696    }
    46914697
    4692     HRESULT rc = mVirtualBox->unregisterHardDisk(this);
     4698    HRESULT rc = E_FAIL;
     4699    switch (m->devType)
     4700    {
     4701        case DeviceType_DVD:
     4702            rc = mVirtualBox->unregisterDVDImage(this);
     4703            break;
     4704        case DeviceType_Floppy:
     4705            rc = mVirtualBox->unregisterFloppyImage(this);
     4706            break;
     4707        case DeviceType_HardDisk:
     4708            rc = mVirtualBox->unregisterHardDisk(this);
     4709            break;
     4710        default:
     4711            break;
     4712    }
    46934713
    46944714    if (FAILED(rc))
  • trunk/src/VBox/Main/include/MediumImpl.h

    r23257 r23591  
    8888    HRESULT init(VirtualBox *aVirtualBox,
    8989                 Medium *aParent,
    90                  DeviceType_T aType,
     90                 DeviceType_T aDeviceType,
    9191                 const settings::Medium &data);
    9292    // initializer for host floppy/DVD
    9393    HRESULT init(VirtualBox *aVirtualBox,
    94                  DeviceType_T aType,
     94                 DeviceType_T aDeviceType,
    9595                 CBSTR aLocation,
    9696                 CBSTR aDescription = NULL);
Note: See TracChangeset for help on using the changeset viewer.

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