VirtualBox

Changeset 79793 in vbox for trunk


Ignore:
Timestamp:
Jul 15, 2019 1:25:42 PM (6 years ago)
Author:
vboxsync
Message:

Main/Medium: Fix for setting create-only medium properties when querying info. Related to bugref:5899.

File:
1 edited

Legend:

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

    r79742 r79793  
    80348034
    80358035DECLCALLBACK(int) Medium::i_vdConfigUpdate(void *pvUser,
    8036                                                 bool fCreate,
    8037                                                 const char *pszName,
    8038                                                 const char *pszValue)
    8039 {
     8036                                           bool fCreate,
     8037                                           const char *pszName,
     8038                                           const char *pszValue)
     8039{
     8040    Medium *that = (Medium *)pvUser;
     8041
     8042    // Detect if this runs inside i_queryInfo() on the current thread.
     8043    // Skip if not. Check does not need synchronization.
     8044    if (!that->m || !that->m->queryInfoRunning || !that->m->queryInfoSem.isWriteLockOnCurrentThread())
     8045        return VINF_SUCCESS;
     8046
     8047    // It's guaranteed that this code is executing inside Medium::i_queryInfo,
     8048    // can assume it took care of synchronization.
    80408049    int rv = VINF_SUCCESS;
    8041     Utf8Str pName = Utf8Str(pszName);
    8042     Medium *that = (Medium *)pvUser;
    8043     AutoWriteLock mlock(that COMMA_LOCKVAL_SRC_POS);
    8044     settings::StringsMap::const_iterator it = that->m->mapProperties.find(pName);
     8050    Utf8Str strName(pszName);
     8051    settings::StringsMap::const_iterator it = that->m->mapProperties.find(strName);
    80458052    if (it == that->m->mapProperties.end() && !fCreate)
    80468053        rv = VERR_CFGM_VALUE_NOT_FOUND;
    80478054    else
    8048         that->m->mapProperties[pName] = Utf8Str(pszValue);
    8049     mlock.release();
     8055        that->m->mapProperties[strName] = Utf8Str(pszValue);
    80508056    return rv;
    80518057}
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