Changeset 24920 in vbox for trunk/src/VBox/Main/SnapshotImpl.cpp
- Timestamp:
- Nov 24, 2009 7:09:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/SnapshotImpl.cpp
r24572 r24920 1198 1198 AssertReturn(aStateFilePath, E_POINTER); 1199 1199 1200 LogFlowThisFunc(("aName='%ls' \n", aName));1200 LogFlowThisFunc(("aName='%ls' fTakingSnapshotOnline=%RTbool\n", aName, fTakingSnapshotOnline)); 1201 1201 1202 1202 AutoCaller autoCaller(this); … … 1266 1266 { 1267 1267 LogFlowThisFunc(("Creating differencing hard disks (online=%d)...\n", 1268 fTakingSnapshotOnline));1268 fTakingSnapshotOnline)); 1269 1269 1270 1270 // backup the media data so we can recover if things goes wrong along the day; … … 1283 1283 1, // operation weight; must be the same as in Console::TakeSnapshot() 1284 1284 !!fTakingSnapshotOnline); 1285 1286 if (SUCCEEDED(rc) && mSnapshotData.mLastState == MachineState_Saved) 1285 if (FAILED(rc)) 1286 throw rc; 1287 1288 if (mSnapshotData.mLastState == MachineState_Saved) 1287 1289 { 1288 1290 Utf8Str stateFrom = mSSData->mStateFilePath; … … 1290 1292 1291 1293 LogFlowThisFunc(("Copying the execution state from '%s' to '%s'...\n", 1292 stateFrom.raw(), stateTo.raw()));1294 stateFrom.raw(), stateTo.raw())); 1293 1295 1294 1296 aConsoleProgress->SetNextOperation(Bstr(tr("Copying the execution state")), … … 1308 1310 1309 1311 if (RT_FAILURE(vrc)) 1312 { 1313 /** @todo r=bird: Delete stateTo when appropriate. */ 1310 1314 throw setError(E_FAIL, 1311 1315 tr("Could not copy the state file '%s' to '%s' (%Rrc)"), … … 1313 1317 stateTo.raw(), 1314 1318 vrc); 1319 } 1315 1320 } 1316 1321 } 1317 1322 catch (HRESULT hrc) 1318 1323 { 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 1319 1332 pSnapshot->uninit(); 1320 1333 pSnapshot.setNull(); 1334 mSnapshotData.mLastState = MachineState_Null; 1335 mSnapshotData.mSnapshot.setNull(); 1336 1321 1337 rc = hrc; 1322 1338 } 1323 1339 1324 if (fTakingSnapshotOnline )1340 if (fTakingSnapshotOnline && SUCCEEDED(rc)) 1325 1341 strStateFilePath.cloneTo(aStateFilePath); 1326 1342 else 1327 1343 *aStateFilePath = NULL; 1328 1344 1329 LogFlowThisFunc Leave();1345 LogFlowThisFunc(("LEAVE - %Rhrc [%s]\n", rc, Global::stringifyMachineState(mData->mMachineState) )); 1330 1346 return rc; 1331 1347 } … … 1365 1381 * Restore the state we had when BeginTakingSnapshot() was called, 1366 1382 * Console::fntTakeSnapshotWorker restores its local copy when we return. 1367 * If the state was Running, then let Console::fntTakeSnapshotWorker it1368 * all via Console::Resume().1383 * If the state was Running, then let Console::fntTakeSnapshotWorker do it 1384 * all to avoid races. 1369 1385 */ 1370 1386 if ( mData->mMachineState != mSnapshotData.mLastState
Note:
See TracChangeset
for help on using the changeset viewer.