VirtualBox

Changeset 53603 in vbox


Ignore:
Timestamp:
Dec 25, 2014 7:45:47 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97369
Message:

Main: Don't try to delete the storage of a disk image when the format is not file based while deleting a VM. Fixes an error an leftover files

File:
1 edited

Legend:

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

    r53354 r53603  
    52665266                LogFunc(("Deleting file %s\n", strLocation.c_str()));
    52675267            }
    5268             ComPtr<IProgress> pProgress2;
    5269             rc = pMedium->DeleteStorage(pProgress2.asOutParam());
    5270             if (FAILED(rc)) throw rc;
    5271             rc = task.pProgress->WaitForAsyncProgressCompletion(pProgress2);
    5272             if (FAILED(rc)) throw rc;
    5273             /* Check the result of the asynchronous process. */
    5274             LONG iRc;
    5275             rc = pProgress2->COMGETTER(ResultCode)(&iRc);
    5276             if (FAILED(rc)) throw rc;
    5277             /* If the thread of the progress object has an error, then
    5278              * retrieve the error info from there, or it'll be lost. */
    5279             if (FAILED(iRc))
    5280                 throw setError(ProgressErrorInfo(pProgress2));
     5268            if (pMedium->i_isMediumFormatFile())
     5269            {
     5270                ComPtr<IProgress> pProgress2;
     5271                rc = pMedium->DeleteStorage(pProgress2.asOutParam());
     5272                if (FAILED(rc)) throw rc;
     5273                rc = task.pProgress->WaitForAsyncProgressCompletion(pProgress2);
     5274                if (FAILED(rc)) throw rc;
     5275                /* Check the result of the asynchronous process. */
     5276                LONG iRc;
     5277                rc = pProgress2->COMGETTER(ResultCode)(&iRc);
     5278                if (FAILED(rc)) throw rc;
     5279                /* If the thread of the progress object has an error, then
     5280                 * retrieve the error info from there, or it'll be lost. */
     5281                if (FAILED(iRc))
     5282                    throw setError(ProgressErrorInfo(pProgress2));
     5283            }
    52815284
    52825285            /* Close the medium, deliberately without checking the return
    5283 -            * code, and without leaving any trace in the error info, as
    5284 -            * a failure here is a very minor issue, which shouldn't happen
    5285 -            * as above we even managed to delete the medium. */
     5286             * code, and without leaving any trace in the error info, as
     5287             * a failure here is a very minor issue, which shouldn't happen
     5288             * as above we even managed to delete the medium. */
    52865289            {
    52875290                ErrorInfoKeeper eik;
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