VirtualBox

Changeset 35009 in vbox


Ignore:
Timestamp:
Dec 13, 2010 1:48:07 PM (14 years ago)
Author:
vboxsync
Message:

Main: delete media files on machine deletion only if the medium actually has a file

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

Legend:

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

    r34854 r35009  
    42964296    //    and must be closed first, or closing the parents will fail because they will
    42974297    //    children);
    4298     // 2) media from the youngest snapshots followed those from the parent snapshots until
     4298    // 2) media from the youngest snapshots followed by those from the parent snapshots until
    42994299    //    the root ("first") snapshot of the machine
    43004300    // This order allows for closing the media on this list from the beginning to the end
     
    44024402
    44034403        Utf8Str bstrLocation = pMedium->getLocationFull();
     4404
     4405        bool fDoesMediumNeedFileDeletion = pMedium->isMediumFormatFile();
     4406
    44044407        // close the medium now; if that succeeds, then that means the medium is no longer
    44054408        // in use and we can add it to the list of files to delete
    44064409        rc = pMedium->close(&pTask->llRegistriesThatNeedSaving,
    44074410                            mediumAutoCaller);
    4408         if (SUCCEEDED(rc))
     4411        if (SUCCEEDED(rc) && fDoesMediumNeedFileDeletion)
    44094412            pTask->llFilesToDelete.push_back(bstrLocation);
    44104413    }
  • trunk/src/VBox/Main/MediumImpl.cpp

    r34782 r35009  
    29532953{
    29542954    return m->formatObj;
     2955}
     2956
     2957/**
     2958 * Internal method that returns true if the medium is represented by a file on the host disk
     2959 * (and not iSCSI or something).
     2960 * @return
     2961 */
     2962bool Medium::isMediumFormatFile() const
     2963{
     2964    if (    m->formatObj
     2965         && (m->formatObj->getCapabilities() & MediumFormatCapabilities_File)
     2966       )
     2967        return true;
     2968    return false;
    29552969}
    29562970
  • trunk/src/VBox/Main/include/MediumImpl.h

    r33921 r35009  
    171171    const Utf8Str& getFormat() const;
    172172    const ComObjPtr<MediumFormat> & getMediumFormat() const;
     173    bool isMediumFormatFile() const;
    173174    uint64_t getSize() const;
    174175    DeviceType_T getDeviceType() const;
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