VirtualBox

Changeset 102274 in vbox for trunk


Ignore:
Timestamp:
Nov 23, 2023 1:07:40 PM (15 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10543: UICommon: A bit of rework for UIGuestOSTypeManager prepare/cleanup procedures, to make it wiped out before COM cleanup.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r101382 r102274  
    216216    , m_fWrappersValid(false)
    217217    , m_fVBoxSVCAvailable(true)
    218     , m_pGuestOSTypeManager(new UIGuestOSTypeManager)
    219218    , m_pThreadPool(0)
    220219    , m_pThreadPoolCloud(0)
     220    , m_pGuestOSTypeManager(0)
    221221    , m_pMediumEnumerator(0)
    222222{
     
    227227UICommon::~UICommon()
    228228{
    229     delete m_pGuestOSTypeManager;
    230229    /* Unassign instance: */
    231230    s_pInstance = 0;
     
    267266    /* Load translation based on the current locale: */
    268267    UITranslator::loadLanguage();
     268
     269    /* Prepare guest OS type manager before COM stuff: */
     270    m_pGuestOSTypeManager = new UIGuestOSTypeManager;
    269271
    270272    HRESULT rc = COMBase::InitializeCOM(true);
     
    815817    m_pThreadPoolCloud = 0;
    816818
     819    /* Cleanup guest OS type manager before COM stuff: */
     820    delete m_pGuestOSTypeManager;
     821    m_pGuestOSTypeManager = 0;
     822
    817823    /* Starting COM cleanup: */
    818824    m_comCleanupProtectionToken.lockForWrite();
     
    13931399{
    13941400    emit sigCloudMachineRegistered(strProviderShortName, strProfileName, comMachine);
     1401}
     1402
     1403const UIGuestOSTypeManager &UICommon::guestOSTypeManager()
     1404{
     1405    /* Handle exceptional and undesired case!
     1406     * This object is created and destroyed within own timeframe.
     1407     * If pointer isn't yet initialized or already cleaned up,
     1408     * something is definitely wrong. */
     1409    AssertPtr(m_pGuestOSTypeManager);
     1410    if (!m_pGuestOSTypeManager)
     1411    {
     1412        m_pGuestOSTypeManager = new UIGuestOSTypeManager;
     1413        m_pGuestOSTypeManager->reCacheGuestOSTypes(m_comVBox.GetGuestOSTypes());
     1414    }
     1415
     1416    /* Return an object instance: */
     1417    return *m_pGuestOSTypeManager;
    13951418}
    13961419
     
    25092532KGraphicsControllerType UICommon::getRecommendedGraphicsController(const QString &strGuestOSTypeId) const
    25102533{
    2511     if (!m_pGuestOSTypeManager)
    2512         return KGraphicsControllerType_Null;
    2513     return m_pGuestOSTypeManager->getRecommendedGraphicsController(strGuestOSTypeId);
     2534    return   m_pGuestOSTypeManager
     2535           ? m_pGuestOSTypeManager->getRecommendedGraphicsController(strGuestOSTypeId)
     2536           : KGraphicsControllerType_Null;
    25142537}
    25152538
     
    29472970    m_strHomeFolder = virtualBox().GetHomeFolder();
    29482971
    2949     /* Re-initialize guest OS Type database: */
     2972    /* Re-initialize guest OS type database: */
    29502973    if (m_pGuestOSTypeManager)
    29512974        m_pGuestOSTypeManager->reCacheGuestOSTypes(m_comVBox.GetGuestOSTypes());
     2975
    29522976    /* Mark wrappers valid: */
    29532977    m_fWrappersValid = true;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r101383 r102274  
    314314    /** @} */
    315315
    316     /** @name COM: Guest OS Type stuff.
    317      * @{ */
    318         const UIGuestOSTypeManager &guestOSTypeManager() const { return *m_pGuestOSTypeManager; }
    319     /** @} */
    320 
    321316    /** @name COM: Virtual Machine stuff.
    322317     * @{ */
     
    354349                                          const QString &strProfileName,
    355350                                          const CCloudMachine &comMachine);
     351    /** @} */
     352
     353    /** @name COM: Guest OS type stuff.
     354     * @{ */
     355        const UIGuestOSTypeManager &guestOSTypeManager();
    356356    /** @} */
    357357
     
    730730        /** Holds whether VBoxSVC is currently available. */
    731731        bool  m_fVBoxSVCAvailable;
    732 
    733         UIGuestOSTypeManager *m_pGuestOSTypeManager;
    734732    /** @} */
    735733
     
    742740    /** @} */
    743741
     742    /** @name Guest OS type related stuff.
     743     * @{ */
     744        /** Holds the guest OS type manager instance. */
     745        UIGuestOSTypeManager *m_pGuestOSTypeManager;
     746    /** @} */
     747
    744748    /** @name Media related stuff.
    745749     * @{ */
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