VirtualBox

Changeset 45909 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
May 6, 2013 1:26:33 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85537
Message:

Main: don't create a guest property if it does not exist and should be removed

File:
1 edited

Legend:

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

    r45882 r45909  
    57525752        Utf8Str utf8Flags(aFlags);
    57535753        uint32_t fFlags = NILFLAG;
    5754         if (   (aFlags != NULL)
    5755             && RT_FAILURE(validateFlags(utf8Flags.c_str(), &fFlags))
    5756            )
     5754        if (   aFlags != NULL
     5755            && RT_FAILURE(validateFlags(utf8Flags.c_str(), &fFlags)))
    57575756            return setError(E_INVALIDARG,
    57585757                            tr("Invalid guest property flag values: '%ls'"),
    57595758                            aFlags);
    57605759
     5760        bool fDelete = !RT_VALID_PTR(aValue) || *(aValue) == '\0';
    57615761        HWData::GuestPropertyMap::iterator it =
    57625762            mHWData->mGuestProperties.find(utf8Name);
     
    57645764        if (it == mHWData->mGuestProperties.end())
    57655765        {
    5766             setModified(IsModified_MachineData);
    5767             mHWData.backupEx();
    5768 
    5769             RTTIMESPEC time;
    5770             HWData::GuestProperty prop;
    5771             prop.strValue = aValue;
    5772             prop.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time));
    5773             prop.mFlags = fFlags;
    5774 
    5775             mHWData->mGuestProperties[Utf8Str(aName)] = prop;
     5766            /* only create the new property if this is really desired */
     5767            if (!fDelete)
     5768            {
     5769                setModified(IsModified_MachineData);
     5770                mHWData.backupEx();
     5771
     5772                RTTIMESPEC time;
     5773                HWData::GuestProperty prop;
     5774                prop.strValue = aValue;
     5775                prop.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time));
     5776                prop.mFlags = fFlags;
     5777
     5778                mHWData->mGuestProperties[Utf8Str(aName)] = prop;
     5779            }
    57765780        }
    57775781        else
     
    57935797                Assert(it != mHWData->mGuestProperties.end());
    57945798
    5795                 if (RT_VALID_PTR(aValue) && *(aValue) != '\0')
     5799                if (!fDelete)
    57965800                {
    57975801                    RTTIMESPEC time;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette