VirtualBox

Ignore:
Timestamp:
Jul 29, 2010 3:07:48 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64226
Message:

Main: extend Machine::unregister() to no longer fail with machines in 'saved' states, but delete the saved state automatically; remove boolean parameter from IConsole::forgetSavedState() which had to be true for the function to do anything useful anyway; remove corresponding internal sessionmachine method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r31070 r31218  
    160160    {
    161161        SafeArray<BSTR> abstrFiles;
    162         CHECK_ERROR(machine, Unregister(false /* fDetachMedia */,
     162        CHECK_ERROR(machine, Unregister(fDelete /* fAutoCleanup */,
    163163                                        ComSafeArrayAsOutParam(abstrFiles)));
    164         if (SUCCEEDED(rc) && fDelete)
    165             CHECK_ERROR(machine, Delete());
     164        if (SUCCEEDED(rc))
     165        {
     166            for (size_t u = 0;
     167                 u < abstrFiles.size();
     168                 ++u)
     169            {
     170                Utf8Str strFile(abstrFiles[u]);
     171                if (fDelete)
     172                {
     173                    RTPrintf("Deleting '%s'\n", strFile.c_str());
     174                    RTFileDelete(strFile.c_str());
     175                }
     176                else
     177                    RTPrintf("File '%s' is now obsolete and can be deleted\n", strFile.c_str());
     178            }
     179
     180            if (fDelete)
     181            {
     182                CHECK_ERROR(machine, Delete());
     183            }
     184        }
    166185    }
    167186    return SUCCEEDED(rc) ? 0 : 1;
     
    423442                ComPtr<IConsole> console;
    424443                CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam()));
    425                 CHECK_ERROR_BREAK(console, ForgetSavedState(true));
     444                CHECK_ERROR_BREAK(console, ForgetSavedState());
    426445            } while (0);
    427446            CHECK_ERROR_BREAK(a->session, UnlockMachine());
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