VirtualBox

儲存庫 vbox 的更動 40491


忽略:
時間撮記:
2012-3-15 下午08:52:05 (13 年 以前)
作者:
vboxsync
訊息:

Main/NetworkAdapter: Take the easy solution out of the reference hell created by the SessionMachine logic. Since the BandwidthGroup objects are not logically located below NetworkAdapter (they are under Machine/BandwidthControl) it is effectively impossible to get the right references in the object. Querying through the appropriate Machine object is guaranteed to give the right result.

位置:
trunk/src/VBox/Main
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/include/NetworkAdapterImpl.h

    r37200 r40491  
    7070        settings::StringsMap mGenericProperties;
    7171        ULONG mBootPriority;
    72         ComObjPtr<BandwidthGroup> mBandwidthGroup;
     72        Utf8Str mBandwidthGroup;
    7373    };
    7474
  • trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp

    r40490 r40491  
    12341234    data.ulBootPriority = mData->mBootPriority;
    12351235
    1236     if (mData->mBandwidthGroup.isNull())
    1237         data.strBandwidthGroup = "";
    1238     else
    1239         data.strBandwidthGroup = mData->mBandwidthGroup->getName();
     1236    data.strBandwidthGroup = mData->mBandwidthGroup;
    12401237
    12411238    data.type = mData->mAdapterType;
     
    13091306        if (mPeer)
    13101307        {
    1311             if (!mData->mBandwidthGroup.isNull())
    1312             {
    1313                 Assert(!mData->mBandwidthGroup->getPeer().isNull() && mData->mBandwidthGroup->getPeer()->getPeer().isNull());
    1314                 mData->mBandwidthGroup = mData->mBandwidthGroup->getPeer();
    1315             }
    13161308            /* attach new data to the peer and reshare it */
    13171309            mPeer->mData.attach(mData);
     
    14031395    CheckComArgOutPointerValid(aBwGroup);
    14041396
    1405     AutoCaller autoCaller(this);
    1406     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1407 
    1408     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    1409 
    1410     mData->mBandwidthGroup.queryInterfaceTo(aBwGroup);
     1397    HRESULT hrc = S_OK;
     1398
     1399    AutoCaller autoCaller(this);
     1400    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     1401
     1402    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1403
     1404    if (mData->mBandwidthGroup.isNotEmpty())
     1405    {
     1406        ComObjPtr<BandwidthGroup> pBwGroup;
     1407        hrc = mParent->getBandwidthGroup(mData->mBandwidthGroup, pBwGroup, true /* fSetError */);
     1408
     1409        Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */
     1410
     1411        if (SUCCEEDED(hrc))
     1412            pBwGroup.queryInterfaceTo(aBwGroup);
     1413    }
    14111414
    14121415    LogFlowThisFuncLeave();
    1413     return S_OK;
     1416    return hrc;
    14141417}
    14151418
     
    14271430    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    14281431
    1429     if (mData->mBandwidthGroup != aBwGroup)
    1430     {
     1432    Utf8Str strBwGroup;
     1433    if (aBwGroup)
     1434        strBwGroup = static_cast<BandwidthGroup*>(aBwGroup)->getName();
     1435    if (mData->mBandwidthGroup != strBwGroup)
     1436    {
     1437        ComObjPtr<BandwidthGroup> pBwGroup;
     1438        if (!strBwGroup.isEmpty())
     1439        {
     1440            HRESULT hrc = mParent->getBandwidthGroup(strBwGroup, pBwGroup, false /* fSetError */);
     1441
     1442            Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */
     1443        }
     1444
    14311445        mData.backup();
    14321446
    1433         updateBandwidthGroup(static_cast<BandwidthGroup*>(aBwGroup));
     1447        updateBandwidthGroup(pBwGroup);
    14341448
    14351449        m_fModified = true;
     
    14541468    Assert(isWriteLockOnCurrentThread());
    14551469
     1470    ComObjPtr<BandwidthGroup> pOldBwGroup;
     1471    if (!mData->mBandwidthGroup.isEmpty())
     1472        {
     1473            HRESULT hrc = mParent->getBandwidthGroup(mData->mBandwidthGroup, pOldBwGroup, false /* fSetError */);
     1474
     1475            Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */
     1476        }
     1477
    14561478    mData.backup();
    1457     if (!mData->mBandwidthGroup.isNull())
    1458     {
    1459         mData->mBandwidthGroup->release();
    1460         mData->mBandwidthGroup.setNull();
     1479    if (!pOldBwGroup.isNull())
     1480    {
     1481        pOldBwGroup->release();
     1482        mData->mBandwidthGroup = Utf8Str::Empty;
    14611483    }
    14621484
    14631485    if (aBwGroup)
    14641486    {
    1465         mData->mBandwidthGroup = aBwGroup;
    1466         mData->mBandwidthGroup->reference();
     1487        mData->mBandwidthGroup = aBwGroup->getName();
     1488        aBwGroup->reference();
    14671489    }
    14681490
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette