VirtualBox

Changeset 38397 in vbox


Ignore:
Timestamp:
Aug 10, 2011 12:17:28 PM (13 years ago)
Author:
vboxsync
Message:

Main/Medium: fix object locks and medium lock state in createDiffStorage()

File:
1 edited

Legend:

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

    r38308 r38397  
    25372537    ComObjPtr<Medium> diff = static_cast<Medium*>(aTarget);
    25382538
     2539    // locking: we need the tree lock first because we access parent pointers
     2540    AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    25392541    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    25402542
     
    25632565        return rc;
    25642566    }
     2567
     2568    rc = pMediumLockList->Lock();
     2569    if (FAILED(rc))
     2570    {
     2571        delete pMediumLockList;
     2572
     2573        return setError(rc, tr("Could not lock medium when creating diff '%s'"),
     2574                        diff->getLocationFull().c_str());
     2575    }
     2576    treeLock.release();
     2577    alock.release();
    25652578
    25662579    ComObjPtr <Progress> pProgress;
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