VirtualBox

Changeset 42021 in vbox for trunk


Ignore:
Timestamp:
Jul 4, 2012 2:18:14 PM (13 years ago)
Author:
vboxsync
Message:

Main/Machine: added a caller and a read lock before calling of MediumAttachment instance in the function RemoveStorageController.

File:
1 edited

Legend:

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

    r42015 r42021  
    58275827    if (FAILED(rc)) return rc;
    58285828
    5829     {/* find all attached devices to the appropriate storage controller and detach them all*/
    5830         MediaData::AttachmentList::const_iterator beginList = mMediaData->mAttachments.begin();
     5829    {
     5830        /* find all attached devices to the appropriate storage controller and detach them all*/
    58315831        MediaData::AttachmentList::const_iterator endList = mMediaData->mAttachments.end();
     5832        MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin();
     5833        MediumAttachment *pAttachTemp=NULL;
    58325834        LONG port = 0;
    58335835        LONG device = 0;
    58345836
    5835         for (MediaData::AttachmentList::const_iterator it = beginList;
    5836              it != endList;
    5837              it++)
    5838         {
    5839             if ((*it)->getControllerName() == aName)
     5837        for (;it != endList; it++)
     5838        {
     5839            pAttachTemp = *it;
     5840            AutoCaller localAutoCaller(pAttachTemp);
     5841            if (FAILED(localAutoCaller.rc())) return localAutoCaller.rc();
     5842
     5843            AutoReadLock local_alock(pAttachTemp COMMA_LOCKVAL_SRC_POS);
     5844
     5845            if (pAttachTemp->getControllerName() == aName)
    58405846            {
    5841                 port = (*it)->getPort();
    5842 
    5843                 device = (*it)->getDevice();
     5847
     5848                port = pAttachTemp->getPort();
     5849
     5850                device = pAttachTemp->getDevice();
    58445851
    58455852                rc = DetachDevice(aName, port, device);
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