Changeset 38996 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Oct 14, 2011 12:59:50 PM (13 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r38887 r38996 106 106 Machine::Data::Data() 107 107 { 108 mRegistered = FALSE; 109 pMachineConfigFile = NULL; 110 flModifications = 0; 111 mAccessible = FALSE; 108 mRegistered = FALSE; 109 pMachineConfigFile = NULL; 110 /* Contains hints on what has changed when the user is using the VM (config 111 * changes, running the VM, ...). This is used to decide if a config needs 112 * to be written to disk. */ 113 flModifications = 0; 114 /* VM modification usually also trigger setting the current state to 115 * "Modified". Although this is not always the case. An e.g. is the VM 116 * initialization phase or when snapshot related data is changed. The 117 * actually behavior is controlled by the following flag. */ 118 m_fAllowStateModification = false; 119 mAccessible = FALSE; 112 120 /* mUuid is initialized in Machine::init() */ 113 121 114 mMachineState = MachineState_PoweredOff;122 mMachineState = MachineState_PoweredOff; 115 123 RTTimeNow(&mLastStateChange); 116 124 117 mMachineStateDeps = 0;118 mMachineStateDepsSem = NIL_RTSEMEVENTMULTI;125 mMachineStateDeps = 0; 126 mMachineStateDepsSem = NIL_RTSEMEVENTMULTI; 119 127 mMachineStateChangePending = 0; 120 128 121 mCurrentStateModified = TRUE;122 mGuestPropertiesModified = FALSE;123 124 mSession.mPid = NIL_RTPROCESS;125 mSession.mState = SessionState_Unlocked;129 mCurrentStateModified = TRUE; 130 mGuestPropertiesModified = FALSE; 131 132 mSession.mPid = NIL_RTPROCESS; 133 mSession.mState = SessionState_Unlocked; 126 134 } 127 135 … … 327 335 } 328 336 337 /* At this point the changing of the current state modification 338 * flag is allowed. */ 339 allowStateModification(); 340 329 341 /* commit all changes made during the initialization */ 330 342 commit(); … … 425 437 if (FAILED(rc)) throw rc; 426 438 439 /* At this point the changing of the current state modification 440 * flag is allowed. */ 441 allowStateModification(); 442 427 443 commit(); 428 444 } … … 464 480 } 465 481 482 #include <iprt/cpp/autores.h> 466 483 /** 467 484 * Initializes a new instance from a machine config that is already in memory … … 518 535 mUserData->s.strName = strName; 519 536 520 /* commit all changes made during the initialization */521 537 if (SUCCEEDED(rc)) 538 { 539 /* At this point the changing of the current state modification 540 * flag is allowed. */ 541 allowStateModification(); 542 543 /* commit all changes made during the initialization */ 522 544 commit(); 545 } 523 546 } 524 547 … … 6334 6357 * @param fl 6335 6358 */ 6336 void Machine::setModified(uint32_t fl )6359 void Machine::setModified(uint32_t fl, bool fAllowStateModification /* = true */) 6337 6360 { 6338 6361 mData->flModifications |= fl; 6339 mData->mCurrentStateModified = true; 6362 if (fAllowStateModification && isStateModificationAllowed()) 6363 mData->mCurrentStateModified = true; 6340 6364 } 6341 6365 … … 6346 6370 * @param fModifications The flag to add. 6347 6371 */ 6348 void Machine::setModifiedLock(uint32_t fModification )6372 void Machine::setModifiedLock(uint32_t fModification, bool fAllowStateModification /* = true */) 6349 6373 { 6350 6374 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6351 setModified(fModification );6375 setModified(fModification, fAllowStateModification); 6352 6376 } 6353 6377 -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r38818 r38996 1225 1225 bool fNeedsGlobalSaveSettings = false; 1226 1226 1227 // flag the machine as dirty or change won't get saved 1228 mPeer->setModified(Machine::IsModified_Snapshots); 1227 /* Flag the machine as dirty or change won't get saved. We disable the 1228 * modification of the current state flag, cause this snapshot data isn't 1229 * related to the current state. */ 1230 mPeer->setModified(Machine::IsModified_Snapshots, false /* fAllowStateModification */); 1229 1231 HRESULT rc = mPeer->saveSettings(&fNeedsGlobalSaveSettings, 1230 1232 SaveS_Force); // we know we need saving, no need to check
Note:
See TracChangeset
for help on using the changeset viewer.