VirtualBox

Changeset 78825 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
May 28, 2019 3:59:04 PM (6 years ago)
Author:
vboxsync
Message:

Main: bugref:6913: Fixed IMediumRegisteredEvent issues

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r78766 r78825  
    21842184    Guid snapshotId;
    21852185    std::set<ComObjPtr<Medium> > pMediumsForNotify;
    2186     std::map<Guid, DeviceType_T> uIdsForNotify;
     2186    std::map<Guid, std::pair<DeviceType_T, BOOL>> uIdsForNotify;
    21872187
    21882188    try
     
    23112311                {
    23122312                    pMediumsForNotify.insert(pMedium->i_getParent());
    2313                     uIdsForNotify[pMedium->i_getId()] = pMedium->i_getDeviceType();
     2313                    uIdsForNotify[pMedium->i_getId()] = std::pair<DeviceType_T, BOOL>(pMedium->i_getDeviceType(), TRUE);
    23142314                }
    23152315            }
     
    24222422            {
    24232423                pMediumsForNotify.insert(pParent);
     2424                uIdsForNotify[pMedium->i_getId()] = std::pair<DeviceType_T, BOOL>(pMedium->i_getDeviceType(), FALSE);
    24242425                pMedium->uninit();
    24252426            }
     
    24522453    {
    24532454        mParent->i_onSnapshotRestored(mData->mUuid, snapshotId);
    2454         for (std::map<Guid, DeviceType_T>::const_iterator it = uIdsForNotify.begin();
     2455        for (std::map<Guid, std::pair<DeviceType_T, BOOL>>::const_iterator it = uIdsForNotify.begin();
    24552456             it != uIdsForNotify.end();
    24562457             ++it)
    24572458        {
    2458             mParent->i_onMediumRegistered(it->first, it->second, TRUE);
     2459            mParent->i_onMediumRegistered(it->first, it->second.first, it->second.second);
    24592460        }
    24602461        for (std::set<ComObjPtr<Medium> >::const_iterator it = pMediumsForNotify.begin();
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r78763 r78825  
    758758    AutoWriteLock treeLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    759759
     760    std::map<Guid, DeviceType_T> uIdsForNotify;
     761
    760762    HRESULT rc = S_OK;
    761763    settings::MediaList::const_iterator it;
     
    778780
    779781        rc = i_registerMedium(pHardDisk, &pHardDisk, treeLock);
     782        if (SUCCEEDED(rc))
     783            uIdsForNotify[pHardDisk->i_getId()] = DeviceType_HardDisk;
    780784        // Avoid trouble with lock/refcount, before returning or not.
    781785        treeLock.release();
     
    803807
    804808        rc = i_registerMedium(pImage, &pImage, treeLock);
     809        if (SUCCEEDED(rc))
     810            uIdsForNotify[pImage->i_getId()] = DeviceType_DVD;
    805811        // Avoid trouble with lock/refcount, before returning or not.
    806812        treeLock.release();
     
    828834
    829835        rc = i_registerMedium(pImage, &pImage, treeLock);
     836        if (SUCCEEDED(rc))
     837            uIdsForNotify[pImage->i_getId()] = DeviceType_Floppy;
    830838        // Avoid trouble with lock/refcount, before returning or not.
    831839        treeLock.release();
     
    833841        treeLock.acquire();
    834842        if (FAILED(rc)) return rc;
     843    }
     844
     845    if (SUCCEEDED(rc))
     846    {
     847        for (std::map<com::Guid, DeviceType_T>::const_iterator it = uIdsForNotify.begin();
     848             it != uIdsForNotify.end();
     849             ++it)
     850        {
     851            i_onMediumRegistered(it->first, it->second, TRUE);
     852        }
    835853    }
    836854
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