VirtualBox

Changeset 62105 in vbox for trunk


Ignore:
Timestamp:
Jul 7, 2016 2:20:33 PM (9 years ago)
Author:
vboxsync
Message:

Main/Machine: fix extradata map copying to work where STL isn't checking for self assignment of maps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r62014 r62105  
    86888688    if (FAILED(rc)) return rc;
    86898689
    8690     /* Copy the extra data items (Not in any case config is already the same as
    8691      * mData->pMachineConfigFile, like when the xml files are read from disk. So
    8692      * make sure the extra data map is copied). */
    8693     mData->pMachineConfigFile->mapExtraDataItems = config.mapExtraDataItems;
     8690    /* Copy the extra data items (config may or may not be the same as
     8691     * mData->pMachineConfigFile) if necessary. When loading the XML files
     8692     * from disk they are the same, but not for OVF import. */
     8693    if (mData->pMachineConfigFile != &config)
     8694        mData->pMachineConfigFile->mapExtraDataItems = config.mapExtraDataItems;
    86948695
    86958696    /* currentStateModified (optional, default is true) */
     
    99539954
    99549955        // now go and copy all the settings data from COM to the settings structures
    9955         // (this calles i_saveSettings() on all the COM objects in the machine)
     9956        // (this calls i_saveSettings() on all the COM objects in the machine)
    99569957        i_copyMachineDataToSettings(*pNewConfig);
    99579958
     
    1005510056void Machine::i_copyMachineDataToSettings(settings::MachineConfigFile &config)
    1005610057{
    10057     // deep copy extradata
    10058     config.mapExtraDataItems = mData->pMachineConfigFile->mapExtraDataItems;
     10058    // deep copy extradata, being extra careful with self assignment (the STL
     10059    // map assignment on Mac OS X clang based Xcode isn't checking)
     10060    if (&config != mData->pMachineConfigFile)
     10061        config.mapExtraDataItems = mData->pMachineConfigFile->mapExtraDataItems;
    1005910062
    1006010063    config.uuid = mData->mUuid;
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