Changeset 46720 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Jun 21, 2013 10:07:31 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86641
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r46667 r46720 3479 3479 * Snapshot structure. 3480 3480 * 3481 * @param depth 3481 3482 * @param elmSnapshot 3482 3483 * @param snap 3483 3484 */ 3484 void MachineConfigFile::readSnapshot(const xml::ElementNode &elmSnapshot, 3485 void MachineConfigFile::readSnapshot(uint32_t depth, 3486 const xml::ElementNode &elmSnapshot, 3485 3487 Snapshot &snap) 3486 3488 { 3489 if (depth > SETTINGS_SNAPSHOT_DEPTH_MAX) 3490 throw ConfigFileError(this, &elmSnapshot, N_("Maximum snapshot tree depth of %u exceeded"), depth); 3491 3487 3492 Utf8Str strTemp; 3488 3493 … … 3531 3536 if (pelmChildSnapshot->nameEquals("Snapshot")) 3532 3537 { 3533 Snapshot child; 3534 readSnapshot(*pelmChildSnapshot, child); 3535 snap.llChildSnapshots.push_back(child); 3538 // Use the heap to reduce the stack footprint. Each 3539 // recursion needs over 1K, and there can be VMs with 3540 // deeply nested snapshots. The stack can be quite 3541 // small, especially with XPCOM. 3542 Snapshot *child = new Snapshot(); 3543 readSnapshot(depth + 1, *pelmChildSnapshot, *child); 3544 snap.llChildSnapshots.push_back(*child); 3545 delete child; 3536 3546 } 3537 3547 } … … 3670 3680 Snapshot snap; 3671 3681 // this will recurse into child snapshots, if necessary 3672 readSnapshot( *pelmMachineChild, snap);3682 readSnapshot(1, *pelmMachineChild, snap); 3673 3683 llFirstSnapshot.push_back(snap); 3674 3684 } … … 4551 4561 && (sc.controllerType == StorageControllerType_I82078) 4552 4562 ) 4553 // floppy controller already got written into <Hardware>/<FloppyController> in writeHardware()4563 // floppy controller already got written into <Hardware>/<FloppyController> in buildHardwareXML() 4554 4564 // for pre-1.9 settings 4555 4565 continue; … … 4751 4761 * for the root snapshot of a machine, if present; elmParent then points to the <Snapshots> node under the 4752 4762 * <Machine> node to which <Snapshot> must be added. This may then recurse for child snapshots. 4763 * 4764 * @param depth 4753 4765 * @param elmParent 4754 4766 * @param snap 4755 4767 */ 4756 void MachineConfigFile::buildSnapshotXML(xml::ElementNode &elmParent, 4768 void MachineConfigFile::buildSnapshotXML(uint32_t depth, 4769 xml::ElementNode &elmParent, 4757 4770 const Snapshot &snap) 4758 4771 { 4772 if (depth > SETTINGS_SNAPSHOT_DEPTH_MAX) 4773 throw ConfigFileError(this, NULL, N_("Maximum snapshot tree depth of %u exceeded"), SETTINGS_SNAPSHOT_DEPTH_MAX); 4774 4759 4775 xml::ElementNode *pelmSnapshot = elmParent.createChild("Snapshot"); 4760 4776 … … 4788 4804 { 4789 4805 const Snapshot &child = *it; 4790 buildSnapshotXML( *pelmChildren, child);4806 buildSnapshotXML(depth + 1, *pelmChildren, child); 4791 4807 } 4792 4808 } … … 4925 4941 if ( (fl & BuildMachineXML_IncludeSnapshots) 4926 4942 && llFirstSnapshot.size()) 4927 buildSnapshotXML( elmMachine, llFirstSnapshot.front());4943 buildSnapshotXML(1, elmMachine, llFirstSnapshot.front()); 4928 4944 4929 4945 buildHardwareXML(elmMachine, hardwareMachine, storageMachine);
Note:
See TracChangeset
for help on using the changeset viewer.