VirtualBox

Changeset 35139 in vbox


Ignore:
Timestamp:
Dec 15, 2010 3:13:43 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68976
Message:

Main: use VirtualBox::saveRegistries() instead of plain VirtualBox::saveSettings() on media property changes to make sure the correct registry gets saved

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

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

    r35126 r35139  
    17471747    m->type = aType;
    17481748
    1749     // save the global settings; for that we should hold only the VirtualBox lock
     1749    // save the settings
     1750    GuidList llRegistriesThatNeedSaving;
     1751    addToRegistryIDList(llRegistriesThatNeedSaving);
    17501752    mlock.release();
    1751     AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    1752     HRESULT rc = m->pVirtualBox->saveSettings();
     1753    HRESULT rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving);
    17531754
    17541755    return rc;
     
    18701871                        m->strLocationFull.c_str());
    18711872
     1873    HRESULT rc = S_OK;
     1874
    18721875    if (m->autoReset != !!aAutoReset)
    18731876    {
    18741877        m->autoReset = !!aAutoReset;
    18751878
    1876         // save the global settings; for that we should hold only the VirtualBox lock
     1879        // save the settings
     1880        GuidList llRegistriesThatNeedSaving;
     1881        addToRegistryIDList(llRegistriesThatNeedSaving);
    18771882        mlock.release();
    1878         AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    1879         return m->pVirtualBox->saveSettings();
    1880     }
    1881 
    1882     return S_OK;
    1883 }
     1883        rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving);
     1884    }
     1885
     1886    return rc;
     1887}
     1888
    18841889STDMETHODIMP Medium::COMGETTER(LastAccessError)(BSTR *aLastAccessError)
    18851890{
     
    23002305    it->second = aValue;
    23012306
    2302     // save the global settings; for that we should hold only the VirtualBox lock
     2307    // save the settings
     2308    GuidList llRegistriesThatNeedSaving;
     2309    addToRegistryIDList(llRegistriesThatNeedSaving);
    23032310    mlock.release();
    2304     AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    2305     HRESULT rc = m->pVirtualBox->saveSettings();
     2311    HRESULT rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving);
    23062312
    23072313    return rc;
     
    23772383    }
    23782384
     2385    // save the settings
     2386    GuidList llRegistriesThatNeedSaving;
     2387    addToRegistryIDList(llRegistriesThatNeedSaving);
    23792388    mlock.release();
    2380 
    2381     // saveSettings needs vbox lock
    2382     AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    2383     HRESULT rc = m->pVirtualBox->saveSettings();
     2389    HRESULT rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving);
    23842390
    23852391    return rc;
     
    66046610    {
    66056611        // in asynchronous mode, save settings now
    6606         // for that we should hold only the VirtualBox lock
    6607         AutoWriteLock vboxlock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    6608         m->pVirtualBox->saveSettings();
     6612        GuidList llRegistriesThatNeedSaving;
     6613        addToRegistryIDList(llRegistriesThatNeedSaving);
     6614        rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving);
    66096615    }
    66106616    else
     
    68696875    // now, at the end of this task (always asynchronous), save the settings
    68706876    {
    6871         AutoWriteLock vboxlock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    6872         m->pVirtualBox->saveSettings();
     6877        // save the settings
     6878        GuidList llRegistriesThatNeedSaving;
     6879        addToRegistryIDList(llRegistriesThatNeedSaving);
     6880        rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving);
    68736881    }
    68746882
     
    76237631    // now, at the end of this task (always asynchronous), save the settings
    76247632    {
    7625         AutoWriteLock vboxlock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    7626         m->pVirtualBox->saveSettings();
     7633        // save the settings
     7634        GuidList llRegistriesThatNeedSaving;
     7635        addToRegistryIDList(llRegistriesThatNeedSaving);
     7636        rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving);
    76277637    }
    76287638
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r34795 r35139  
    37323732}
    37333733
     3734/**
     3735 * Saves all settings files according to the given list of UUIDs, which are
     3736 * either machine IDs (in which case Machine::saveSettings is invoked) or
     3737 * the global registry UUID (in which case VirtualBox::saveSettings is invoked).
     3738 *
     3739 * This locks machines and the VirtualBox object as necessary, so better not
     3740 * hold any locks before calling this.
     3741 *
     3742 * @param llRegistriesThatNeedSaving
     3743 * @return
     3744 */
    37343745HRESULT VirtualBox::saveRegistries(const GuidList &llRegistriesThatNeedSaving)
    37353746{
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