VirtualBox

Changeset 42823 in vbox for trunk


Ignore:
Timestamp:
Aug 15, 2012 11:32:14 AM (12 years ago)
Author:
vboxsync
Message:

Main/Machine:

  1. function STDMETHODIMP Machine::RemoveStorageController() - creating temporary list "llAttachments2", because STL::list "mMediaData->mAttachments" produce invalid iterator during deleting items from it inside the function detachDevice().
File:
1 edited

Legend:

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

    r42789 r42823  
    59455945    {
    59465946        /* find all attached devices to the appropriate storage controller and detach them all */
    5947         size_t howManyAttach = mMediaData->mAttachments.size();
    5948 
    5949         for (size_t i = 0; i < howManyAttach; ++i)
    5950         {
    5951             MediumAttachment *pAttachTemp = mMediaData->mAttachments.front();
     5947        // make a temporary list because detachDevice invalidates iterators into
     5948        // mMediaData->mAttachments
     5949        MediaData::AttachmentList llAttachments2 = mMediaData->mAttachments;
     5950
     5951        for (MediaData::AttachmentList::iterator it = llAttachments2.begin();
     5952        it != llAttachments2.end();
     5953        ++it)
     5954        {
     5955            MediumAttachment *pAttachTemp = *it;
    59525956
    59535957            AutoCaller localAutoCaller(pAttachTemp);
     
    59585962            if (pAttachTemp->getControllerName() == aName)
    59595963            {
    5960                 LONG port = pAttachTemp->getPort();
    5961                 LONG device = pAttachTemp->getDevice();
    5962 
    5963                 //rc = DetachDevice(aName, port, device);
    59645964                rc = detachDevice(pAttachTemp, alock, NULL);
    59655965                if (FAILED(rc)) 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