VirtualBox

Changeset 38141 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 25, 2011 10:27:35 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
73096
Message:

Main-CloneVM: fix the recursive snapshot searching

File:
1 edited

Legend:

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

    r38121 r38141  
    108108
    109109    /* MachineCloneVM::run helper: */
    110     settings::Snapshot findSnapshot(settings::MachineConfigFile *pMCF, const settings::SnapshotsList &snl, const Guid &id) const;
     110    bool findSnapshot(const settings::SnapshotsList &snl, const Guid &id, settings::Snapshot &sn) const;
    111111    void updateMACAddresses(settings::NetworkAdaptersList &nwl) const;
    112112    void updateMACAddresses(settings::SnapshotsList &sl) const;
     
    530530}
    531531
    532 settings::Snapshot MachineCloneVMPrivate::findSnapshot(settings::MachineConfigFile *pMCF, const settings::SnapshotsList &snl, const Guid &id) const
     532bool MachineCloneVMPrivate::findSnapshot(const settings::SnapshotsList &snl, const Guid &id, settings::Snapshot &sn) const
    533533{
    534534    settings::SnapshotsList::const_iterator it;
     
    536536    {
    537537        if (it->uuid == id)
    538             return *it;
     538        {
     539            sn = (*it);
     540            return true;
     541        }
    539542        else if (!it->llChildSnapshots.empty())
    540             return findSnapshot(pMCF, it->llChildSnapshots, id);
    541     }
    542     return settings::Snapshot();
     543        {
     544            if (findSnapshot(it->llChildSnapshots, id, sn))
     545                return true;
     546        }
     547    }
     548    return false;
    543549}
    544550
     
    922928        settings::Snapshot sn;
    923929        if (!d->snapshotId.isEmpty())
    924             sn = d->findSnapshot(&trgMCF, trgMCF.llFirstSnapshot, d->snapshotId);
     930            d->findSnapshot(trgMCF.llFirstSnapshot, d->snapshotId, sn);
    925931
    926932        if (d->mode == CloneMode_MachineState)
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