VirtualBox

Ignore:
Timestamp:
Nov 24, 2009 7:09:23 PM (15 years ago)
Author:
vboxsync
Message:

SnapshotImpl.cpp: BeginSnapshot error path (#4486).

File:
1 edited

Legend:

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

    r24572 r24920  
    11981198    AssertReturn(aStateFilePath, E_POINTER);
    11991199
    1200     LogFlowThisFunc(("aName='%ls'\n", aName));
     1200    LogFlowThisFunc(("aName='%ls' fTakingSnapshotOnline=%RTbool\n", aName, fTakingSnapshotOnline));
    12011201
    12021202    AutoCaller autoCaller(this);
     
    12661266    {
    12671267        LogFlowThisFunc(("Creating differencing hard disks (online=%d)...\n",
    1268                         fTakingSnapshotOnline));
     1268                         fTakingSnapshotOnline));
    12691269
    12701270        // backup the media data so we can recover if things goes wrong along the day;
     
    12831283                                 1,            // operation weight; must be the same as in Console::TakeSnapshot()
    12841284                                 !!fTakingSnapshotOnline);
    1285 
    1286         if (SUCCEEDED(rc) && mSnapshotData.mLastState == MachineState_Saved)
     1285        if (FAILED(rc))
     1286            throw rc;
     1287
     1288        if (mSnapshotData.mLastState == MachineState_Saved)
    12871289        {
    12881290            Utf8Str stateFrom = mSSData->mStateFilePath;
     
    12901292
    12911293            LogFlowThisFunc(("Copying the execution state from '%s' to '%s'...\n",
    1292                             stateFrom.raw(), stateTo.raw()));
     1294                             stateFrom.raw(), stateTo.raw()));
    12931295
    12941296            aConsoleProgress->SetNextOperation(Bstr(tr("Copying the execution state")),
     
    13081310
    13091311            if (RT_FAILURE(vrc))
     1312            {
     1313                /** @todo r=bird: Delete stateTo when appropriate. */
    13101314                throw setError(E_FAIL,
    13111315                               tr("Could not copy the state file '%s' to '%s' (%Rrc)"),
     
    13131317                               stateTo.raw(),
    13141318                               vrc);
     1319            }
    13151320        }
    13161321    }
    13171322    catch (HRESULT hrc)
    13181323    {
     1324        LogThisFunc(("Caught %Rhrc [%s]\n", hrc, Global::stringifyMachineState(mData->mMachineState) ));
     1325        if (    mSnapshotData.mLastState != mData->mMachineState
     1326            &&  (  mSnapshotData.mLastState == MachineState_Running
     1327                 ? mData->mMachineState == MachineState_LiveSnapshotting
     1328                 : mData->mMachineState == MachineState_Saving)
     1329           )
     1330            setMachineState(mSnapshotData.mLastState);
     1331
    13191332        pSnapshot->uninit();
    13201333        pSnapshot.setNull();
     1334        mSnapshotData.mLastState = MachineState_Null;
     1335        mSnapshotData.mSnapshot.setNull();
     1336
    13211337        rc = hrc;
    13221338    }
    13231339
    1324     if (fTakingSnapshotOnline)
     1340    if (fTakingSnapshotOnline && SUCCEEDED(rc))
    13251341        strStateFilePath.cloneTo(aStateFilePath);
    13261342    else
    13271343        *aStateFilePath = NULL;
    13281344
    1329     LogFlowThisFuncLeave();
     1345    LogFlowThisFunc(("LEAVE - %Rhrc [%s]\n", rc, Global::stringifyMachineState(mData->mMachineState) ));
    13301346    return rc;
    13311347}
     
    13651381     * Restore the state we had when BeginTakingSnapshot() was called,
    13661382     * Console::fntTakeSnapshotWorker restores its local copy when we return.
    1367      * If the state was Running, then let Console::fntTakeSnapshotWorker it
    1368      * all via Console::Resume().
     1383     * If the state was Running, then let Console::fntTakeSnapshotWorker do it
     1384     * all to avoid races.
    13691385     */
    13701386    if (   mData->mMachineState != mSnapshotData.mLastState
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