Changeset 55833 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 12, 2015 5:52:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r55807 r55833 9068 9068 9069 9069 #ifdef VBOX_WITH_GUEST_PROPS 9070 /* Only load transient guest properties for configs which have saved 9071 * state, because there shouldn't be any for powered off VMs. The same 9072 * logic applies for snapshots, as offline snapshots shouldn't have 9073 * any such properties. They confuse the code in various places. 9074 * Note: can't rely on the machine state, as it isn't set yet. */ 9075 bool fSkipTransientGuestProperties = mSSData->strStateFilePath.isEmpty(); 9070 9076 /* Guest properties (optional) */ 9071 9077 for (settings::GuestPropertiesList::const_iterator it = data.llGuestProperties.begin(); … … 9076 9082 uint32_t fFlags = guestProp::NILFLAG; 9077 9083 guestProp::validateFlags(prop.strFlags.c_str(), &fFlags); 9084 if ( fSkipTransientGuestProperties 9085 && ( fFlags & guestProp::TRANSIENT 9086 || fFlags & guestProp::TRANSRESET)) 9087 continue; 9078 9088 HWData::GuestProperty property = { prop.strValue, (LONG64) prop.timestamp, fFlags }; 9079 9089 mHWData->mGuestProperties[prop.strName] = property; … … 10361 10371 10362 10372 /* Remove transient guest properties at shutdown unless we 10363 * are saving state */ 10373 * are saving state. Note that restoring snapshot intentionally 10374 * keeps them, they will be removed if appropriate once the final 10375 * machine state is set (as crashes etc. need to work). */ 10364 10376 if ( ( mData->mMachineState == MachineState_PoweredOff 10365 10377 || mData->mMachineState == MachineState_Aborted … … 14484 14496 mPeer->i_setMachineState(aMachineState); 14485 14497 14486 if ( aMachineState == MachineState_PoweredOff 14487 || aMachineState == MachineState_Teleported 14488 || aMachineState == MachineState_Aborted 14489 || aMachineState == MachineState_Saved) 14498 if ( oldMachineState != MachineState_RestoringSnapshot 14499 && ( aMachineState == MachineState_PoweredOff 14500 || aMachineState == MachineState_Teleported 14501 || aMachineState == MachineState_Aborted 14502 || aMachineState == MachineState_Saved)) 14490 14503 { 14491 14504 /* the machine has stopped execution … … 14514 14527 BOOL fNeedsSaving = mData->mGuestPropertiesModified; 14515 14528 14529 /* remove it from the settings representation */ 14516 14530 settings::GuestPropertiesList &llGuestProperties = mData->pMachineConfigFile->hardwareMachine.llGuestProperties; 14517 settings::GuestPropertiesList::iterator it = llGuestProperties.begin(); 14518 while (it != llGuestProperties.end()) 14531 for (settings::GuestPropertiesList::iterator it = llGuestProperties.begin(); 14532 it != llGuestProperties.end(); 14533 /*nothing*/) 14519 14534 { 14520 14535 const settings::GuestProperty &prop = *it; … … 14523 14538 { 14524 14539 it = llGuestProperties.erase(it); 14540 fNeedsSaving = true; 14541 } 14542 else 14543 { 14544 ++it; 14545 } 14546 } 14547 14548 /* Additionally remove it from the HWData representation. Required to 14549 * keep everything in sync, as this is what the API keeps using. */ 14550 HWData::GuestPropertyMap &llHWGuestProperties = mHWData->mGuestProperties; 14551 for (HWData::GuestPropertyMap::iterator it = llHWGuestProperties.begin(); 14552 it != llHWGuestProperties.end(); 14553 /*nothing*/) 14554 { 14555 uint32_t fFlags = it->second.mFlags; 14556 if ( fFlags & guestProp::TRANSIENT 14557 || fFlags & guestProp::TRANSRESET) 14558 { 14559 /* iterator where we need to continue after the erase call 14560 * (C++03 is a fact still, and it doesn't return the iterator 14561 * which would allow continuing) */ 14562 HWData::GuestPropertyMap::iterator it2 = it; 14563 ++it2; 14564 llHWGuestProperties.erase(it); 14565 it = it2; 14525 14566 fNeedsSaving = true; 14526 14567 }
Note:
See TracChangeset
for help on using the changeset viewer.