VirtualBox

Changeset 106062 in vbox


Ignore:
Timestamp:
Sep 16, 2024 3:48:55 PM (4 months ago)
Author:
vboxsync
Message:

Unattended: ​bugref:10511. Avoid tripping lock order assert when Unattended::prepare is called.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/UnattendedImpl.h

    r106061 r106062  
    166166    RTCList<WIMImage> mDetectedImages;
    167167    bool            mfAvoidUpdatesOverNetwork;
     168    com::SafeIfaceArray<IGuestOSType> mSupportedGuestOSTypes;
     169    bool           mfDoneSupportedGuestOSList;
    168170    /** @} */
    169171
     
    331333    bool i_updateDetectedAttributeForImage(WIMImage const &rImage);
    332334
     335    /**
     336     * Gets the list of guest OS type IDs supported by the current host.
     337     */
     338    HRESULT i_getListOfSupportedGuestOS();
     339
    333340};
    334341
  • trunk/src/VBox/Main/src-server/UnattendedImpl.cpp

    r106061 r106062  
    258258    : mhThreadReconfigureVM(NIL_RTNATIVETHREAD), mfRtcUseUtc(false), mfGuestOs64Bit(false)
    259259    , mpInstaller(NULL), mpTimeZoneInfo(NULL), mfIsDefaultAuxiliaryBasePath(true), mfDoneDetectIsoOS(false)
    260     , mfAvoidUpdatesOverNetwork(false)
     260    , mfAvoidUpdatesOverNetwork(false), mfDoneSupportedGuestOSList(false)
    261261{ }
    262262
     
    342342    HRESULT       hrc;
    343343
    344     /* Get a list of guest OS Type Ids supported by the host. */
    345     ComPtr<ISystemProperties> pSystemProperties;
    346     com::SafeIfaceArray<IGuestOSType> supportedGuestOSTypes;
    347 
    348     hrc = mParent->COMGETTER(SystemProperties)(pSystemProperties.asOutParam());
    349     if (SUCCEEDED(hrc))
    350     {
    351         ComPtr<IPlatformProperties> pPlatformProperties;
    352         hrc = pSystemProperties->COMGETTER(Platform)(pPlatformProperties.asOutParam());
    353         if (SUCCEEDED(hrc))
    354         {
    355             hrc = pPlatformProperties->COMGETTER(SupportedGuestOSTypes)(ComSafeArrayAsOutParam(supportedGuestOSTypes));
    356             if (!SUCCEEDED(hrc))
    357                 supportedGuestOSTypes.resize(0);
    358         }
    359     }
     344    /* Populate list of supported guest OSs in case it has not been done yet. Do this before locking. */
     345    if (!mfDoneSupportedGuestOSList)
     346        i_getListOfSupportedGuestOS();
    360347
    361348    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    510497    /* Check if detected OS type is supported (covers platform architecture). */
    511498    bool fSupported = false;
    512     for (size_t i = 0; i < supportedGuestOSTypes.size() && !fSupported; ++i)
    513     {
    514         ComPtr<IGuestOSType> guestOSType = supportedGuestOSTypes[i];
     499    for (size_t i = 0; i < mSupportedGuestOSTypes.size() && !fSupported; ++i)
     500    {
     501        ComPtr<IGuestOSType> guestOSType = mSupportedGuestOSTypes[i];
    515502
    516503        Bstr guestId;
     
    26202607        return hrc;
    26212608
     2609    /* Populate list of supported guest OSs in case it has not been done yet. Do this before locking. */
     2610    if (!mfDoneSupportedGuestOSList)
     2611        i_getListOfSupportedGuestOS();
     2612
    26222613    /*
    26232614     * Write lock this object and set attributes we got from IMachine.
     
    44974488    return fRet;
    44984489}
     4490
     4491HRESULT Unattended::i_getListOfSupportedGuestOS()
     4492{
     4493    HRESULT       hrc;
     4494    if (mfDoneSupportedGuestOSList)
     4495        return S_OK;
     4496    mfDoneSupportedGuestOSList = true;
     4497
     4498    /* Get a list of guest OS Type Ids supported by the host. */
     4499    ComPtr<ISystemProperties> pSystemProperties;
     4500
     4501    hrc = mParent->COMGETTER(SystemProperties)(pSystemProperties.asOutParam());
     4502    if (SUCCEEDED(hrc))
     4503    {
     4504        ComPtr<IPlatformProperties> pPlatformProperties;
     4505        hrc = pSystemProperties->COMGETTER(Platform)(pPlatformProperties.asOutParam());
     4506        if (SUCCEEDED(hrc))
     4507        {
     4508            hrc = pPlatformProperties->COMGETTER(SupportedGuestOSTypes)(ComSafeArrayAsOutParam(mSupportedGuestOSTypes));
     4509            if (!SUCCEEDED(hrc))
     4510                mSupportedGuestOSTypes.resize(0);
     4511        }
     4512    }
     4513    return hrc;
     4514}
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