VirtualBox

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


Ignore:
Timestamp:
Jul 1, 2022 1:17:59 PM (3 years ago)
Author:
vboxsync
Message:

Main/Snapshot: not able to restore from a snapshot more than once if VM
has multiple snapshots. bugref:10252

If a VM has multiple snapshots then restoring from any snapshot beyond
the first will result in that snapshot being deleted during power up.
Any attempt to restore from this snapshot in the future will thus fail
as the file is now gone. Fixed by updating Snapshot::i_sharesSavedStateFile()
to check each snapshot's saved state file rather than just the first
snapshot.

Also 'VBoxManage unregistervm x --delete' fails to remove snapshots due
to a regression in Snapshot::i_uninitAll() which accidentally inverted
the logic when testing if the snapshot was in the llFilenames list
already.

File:
1 edited

Legend:

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

    r95423 r95476  
    763763{
    764764    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    765     const Utf8Str &path = m->pMachine->mSSData->strStateFilePath;
    766 
    767     if (path.isEmpty())
    768         return false;
    769 
    770765    std::list<const Snapshot *> llSnapshotsTodo;
    771766    llSnapshotsTodo.push_back(this);
     
    775770        const Snapshot *pSnapshot = llSnapshotsTodo.front();
    776771        llSnapshotsTodo.pop_front();
    777 
    778         if (!pSnapshotToIgnore || pSnapshotToIgnore != this)
     772        const Utf8Str &path = pSnapshot->m->pMachine->mSSData->strStateFilePath;
     773
     774        if ((!pSnapshotToIgnore || pSnapshotToIgnore != this) && path.isNotEmpty())
    779775            if (path == strPath)
    780776                return true;
     
    998994                std::list<Utf8Str>::const_iterator itFound = find(llFilenames.begin(), llFilenames.end(), strFile);
    999995
    1000                 if (itFound != llFilenames.end())
     996                if (itFound == llFilenames.end())
    1001997                    llFilenames.push_back(strFile);
    1002998            }
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