VirtualBox

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


Ignore:
Timestamp:
Jun 23, 2011 8:38:23 AM (13 years ago)
Author:
vboxsync
Message:

Main-CloneVM: needs tree lock

File:
1 edited

Legend:

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

    r37603 r37604  
    621621                    if (FAILED(rc)) throw rc;
    622622
     623                    srcLock.release();
    623624                    /* Do the disk cloning. */
    624625                    ComPtr<IProgress> progress2;
     
    630631
    631632                    /* Wait until the asynchrony process has finished. */
    632                     srcLock.release();
    633633                    rc = d->pProgress->WaitForAsyncProgressCompletion(progress2);
    634634                    srcLock.acquire();
     
    657657                    map.insert(TStrMediumPair(Utf8Str(bstrSrcId), pTarget));
    658658                    /* Global register the new harddisk */
    659                     rc = p->mParent->registerHardDisk(pTarget, NULL /* pllRegistriesThatNeedSaving */);
    660                     if (FAILED(rc)) return rc;
     659                    {
     660                        AutoWriteLock tlock(p->mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
     661                        rc = p->mParent->registerHardDisk(pTarget, NULL /* pllRegistriesThatNeedSaving */);
     662                        if (FAILED(rc)) return rc;
     663                    }
    661664                    /* This medium becomes the parent of the next medium in the
    662665                     * chain. */
     
    697700                newMedias.append(diff);
    698701                /* Global register the new harddisk */
    699                 rc = p->mParent->registerHardDisk(diff, NULL /* pllRegistriesThatNeedSaving */);
    700                 if (FAILED(rc)) return rc;
     702                {
     703                    AutoWriteLock tlock(p->mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
     704                    rc = p->mParent->registerHardDisk(diff, NULL /* pllRegistriesThatNeedSaving */);
     705                    if (FAILED(rc)) return rc;
     706                }
    701707                /* This medium becomes the parent of the next medium in the
    702708                 * chain. */
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