VirtualBox

Changeset 27592 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Mar 22, 2010 2:19:40 PM (15 years ago)
Author:
vboxsync
Message:

Main: improve r59084 a bit

File:
1 edited

Legend:

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

    r27564 r27592  
    15861586    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    15871587
    1588 #if 1 /** @todo Temporarily hacked so that it won't trigger lock validator errors
    1589        *        and deadlock. */
    1590     /* VirtualBox::saveSettings() needs a write lock and we access mParent & children() */
    1591     AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    1592     AutoMultiWriteLock2 alockGrossHack(&m->pVirtualBox->getMediaTreeLockHandle(), this->lockHandle() COMMA_LOCKVAL_SRC_POS);
    1593 #else
    1594     /* VirtualBox::saveSettings() needs a write lock */
    1595     AutoMultiWriteLock2 alock(m->pVirtualBox, this COMMA_LOCKVAL_SRC_POS);
    1596 #endif
     1588    // we access mParent and members
     1589    AutoMultiWriteLock2 mlock(&m->pVirtualBox->getMediaTreeLockHandle(), this->lockHandle() COMMA_LOCKVAL_SRC_POS);
    15971590
    15981591    switch (m->state)
     
    16101603        return S_OK;
    16111604    }
    1612 
    1613 #if 0 /** @todo temporary hack above. */
    1614     /* we access mParent & children() */
    1615     AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    1616 #endif
    16171605
    16181606    /* cannot change the type of a differencing hard disk */
     
    16531641    m->type = aType;
    16541642
    1655 #if 1 /** @todo remove this gross hack! Just need to get this code working again. */
    1656     alockGrossHack.leave();
    1657 #endif
    1658 
    1659     HRESULT rc = m->pVirtualBox->saveSettings();
     1643    // saveSettings needs vbox lock
     1644    ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox);
     1645    mlock.leave();
     1646    AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
     1647
     1648    HRESULT rc = pVirtualBox->saveSettings();
    16601649
    16611650    return rc;
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