VirtualBox

Changeset 24277 in vbox for trunk/src


Ignore:
Timestamp:
Nov 2, 2009 8:25:02 PM (15 years ago)
Author:
vboxsync
Message:

Main: fix restoreSnapshot() which updated the current snapshot only for online snapshots

File:
1 edited

Legend:

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

    r24273 r24277  
    96169616    MultiResult rc(S_OK);
    96179617
    9618     Snapshot *pOldFirstSnap = mData->mFirstSnapshot;
    9619     Snapshot *pOldCurrentSnap = mData->mCurrentSnapshot;
     9618    ComObjPtr<Snapshot> pOldFirstSnap = mData->mFirstSnapshot;
     9619    ComObjPtr<Snapshot> pOldCurrentSnap = mData->mCurrentSnapshot;
    96209620
    96219621    bool fOnline = Global::IsOnline(mSnapshotData.mLastState);
     
    1011910119
    1012010120                if (RT_SUCCESS(vrc))
    10121                 {
    1012210121                    mSSData->mStateFilePath = stateFilePath;
    10123 
    10124                     /* make the snapshot we restored from the current snapshot */
    10125                     mData->mCurrentSnapshot = aTask.m_pSnapshot;
    10126                 }
    1012710122                else
    1012810123                    throw setError(E_FAIL,
     
    1013210127                                   vrc);
    1013310128            }
     10129
     10130            LogFlowThisFunc(("Setting new current snapshot {%RTuuid}\n", aTask.m_pSnapshot->getId().raw()));
     10131            /* make the snapshot we restored from the current snapshot */
     10132            mData->mCurrentSnapshot = aTask.m_pSnapshot;
    1013410133        }
    1013510134
     
    1020610205        }
    1020710206
    10208         /* save all settings, reset the modified flag and commit */
     10207        // save all settings, reset the modified flag and commit;
     10208        // from here on we cannot roll back on failure any more
    1020910209        rc = saveSettings(SaveS_ResetCurStateModified | saveFlags);
    1021010210
     
    1021710217
    1021810218            HRESULT rc2 = pMedium->deleteStorageAndWait();
     10219            // ignore errors here because we cannot roll back after saveSettings() above
    1021910220            if (SUCCEEDED(rc2))
    1022010221                pMedium->uninit();
     
    1023110232        ErrorInfoKeeper eik;
    1023210233
    10233         /* undo all changes on failure unless the subtask has done so */
     10234        /* undo all changes on failure */
    1023410235        rollback(false /* aNotify */);
    1023510236
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