third_party/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
/**
 * Saves all snapshots of the machine into the given machine config file. Called
 * from Machine::buildMachineXML() and SessionMachine::deleteSnapshotHandler().
 * @param config
 * @return
 */
Saves all snapshots of the machine into the given machine config file.
Saves all snapshots of the machine into the given machine config file .
HRESULT Machine::i_saveAllSnapshots(settings::MachineConfigFile &config)
{
    AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
    HRESULT rc = S_OK;
    try
    {
        config.llFirstSnapshot.clear();
        if (mData->mFirstSnapshot)
        {
            config.llFirstSnapshot.push_back(settings::Snapshot::Empty);
            rc = mData->mFirstSnapshot->i_saveSnapshot(config.llFirstSnapshot.back());
            if (FAILED(rc)) throw rc;
        }
    }
    catch (HRESULT err)
    {
        rc = err;
    }
    catch (...)
    {
        rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }
    return rc;
}
HRESULT Machine :: i_saveAllSnapshots ( settings :: MachineConfigFile & config ) { AssertReturn ( isWriteLockOnCurrentThread ( ) , E_FAIL ) ; HRESULT rc = S_OK ; try { config . llFirstSnapshot . clear ( ) ; if ( mData -> mFirstSnapshot ) { config . llFirstSnapshot . push_back ( settings :: Snapshot :: Empty ) ; rc = mData -> mFirstSnapshot -> i_saveSnapshot ( config . llFirstSnapshot . back ( ) ) ; if ( FAILED ( rc ) ) throw rc ; } } catch ( HRESULT err ) { rc = err ; } catch ( ... ) { rc = VirtualBoxBase :: handleUnexpectedExceptions ( this , RT_SRC_POS ) ; } return rc ; }
Saves all snapshots of the machine into the given machine config file.
Saves all snapshots of the machine into the given machine config file .
// the settings use a list for "the first snapshot" // get reference to the snapshot on the list and work on that // element straight in the list to avoid excessive copying later //         if (mType == IsSessionMachine) //             mParent->onMachineDataChange(mData->mUuid);          @todo is this necessary? /* we assume that error info is set by the thrower */