VirtualBox

Changeset 79217 in vbox


Ignore:
Timestamp:
Jun 18, 2019 4:12:55 PM (5 years ago)
Author:
vboxsync
Message:

Main: bugref:6913: Changed the order of the IMediumRegisterEvents being generated during open existing VM

File:
1 edited

Legend:

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

    r79211 r79217  
    839839    AutoWriteLock treeLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    840840
    841     std::map<Guid, DeviceType_T> uIdsForNotify;
     841    // the order of notification is critical for GUI, so use std::list<std::pair> instead of map
     842    std::list<std::pair<Guid, DeviceType_T> > uIdsForNotify;
    842843
    843844    HRESULT rc = S_OK;
     
    863864        if (SUCCEEDED(rc))
    864865        {
    865             uIdsForNotify[pHardDisk->i_getId()] = DeviceType_HardDisk;
     866            uIdsForNotify.push_back(std::pair<Guid, DeviceType_T>(pHardDisk->i_getId(), DeviceType_HardDisk));
    866867            // Add children IDs to notification using non-recursive children enumeration.
    867868            std::vector<std::pair<MediaList::const_iterator, ComObjPtr<Medium> > > llEnumStack;
     
    877878                    continue;
    878879                }
    879                 uIdsForNotify[(*llEnumStack.back().first)->i_getId()] = DeviceType_HardDisk;
     880                uIdsForNotify.push_back(std::pair<Guid, DeviceType_T>((*llEnumStack.back().first)->i_getId(), DeviceType_HardDisk));
    880881                const MediaList& childMediaList = (*llEnumStack.back().first)->i_getChildren();
    881882                if (!childMediaList.empty())
     
    914915        rc = i_registerMedium(pImage, &pImage, treeLock);
    915916        if (SUCCEEDED(rc))
    916             uIdsForNotify[pImage->i_getId()] = DeviceType_DVD;
     917            uIdsForNotify.push_back(std::pair<Guid, DeviceType_T>(pImage->i_getId(), DeviceType_DVD));
    917918        // Avoid trouble with lock/refcount, before returning or not.
    918919        treeLock.release();
     
    941942        rc = i_registerMedium(pImage, &pImage, treeLock);
    942943        if (SUCCEEDED(rc))
    943             uIdsForNotify[pImage->i_getId()] = DeviceType_Floppy;
     944            uIdsForNotify.push_back(std::pair<Guid, DeviceType_T>(pImage->i_getId(), DeviceType_Floppy));
    944945        // Avoid trouble with lock/refcount, before returning or not.
    945946        treeLock.release();
     
    951952    if (SUCCEEDED(rc))
    952953    {
    953         for (std::map<com::Guid, DeviceType_T>::const_iterator itItem = uIdsForNotify.begin();
     954        for (std::list<std::pair<Guid, DeviceType_T> >::const_iterator itItem = uIdsForNotify.begin();
    954955             itItem != uIdsForNotify.end();
    955956             ++itItem)
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