VirtualBox

Ignore:
Timestamp:
Apr 18, 2016 5:12:52 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​​​bugref:8298: Improve error handling for early failures.

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

Legend:

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

    r60362 r60547  
    435435    error(0, MessageType_Critical,
    436436          tr("<p>Failed to create the VirtualBoxClient COM object.</p>"
     437             "<p>The application will now terminate.</p>"),
     438          formatErrorInfo(client));
     439}
     440
     441void UIMessageCenter::cannotAcquireVirtualBox(const CVirtualBoxClient &client) const
     442{
     443    error(0, MessageType_Critical,
     444          tr("<p>Failed to acquire the VirtualBox COM object.</p>"
    437445             "<p>The application will now terminate.</p>"),
    438446          formatErrorInfo(client));
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r57714 r60547  
    160160    void cannotInitCOM(HRESULT rc) const;
    161161    void cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const;
     162    void cannotAcquireVirtualBox(const CVirtualBoxClient &client) const;
    162163
    163164    /* API: Global warnings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r60500 r60547  
    40164016    }
    40174017
    4018     /* Create VirtualBox client instance: */
     4018    /* Make sure VirtualBoxClient instance created: */
    40194019    m_client.createInstance(CLSID_VirtualBoxClient);
    4020     /* And make sure it was created: */
    40214020    if (!m_client.isOk())
    40224021    {
    40234022        msgCenter().cannotCreateVirtualBoxClient(m_client);
     4023        return;
     4024    }
     4025    /* Make sure VirtualBox instance acquired: */
     4026    m_vbox = m_client.GetVirtualBox();
     4027    if (!m_client.isOk())
     4028    {
     4029        msgCenter().cannotAcquireVirtualBox(m_client);
    40244030        return;
    40254031    }
     
    44964502        m_fWrappersValid = false;
    44974503        /* Re-fetch corresponding CVirtualBox to restart VBoxSVC: */
    4498         // CVirtualBox is still NULL in current Main implementation,
    4499         // and this call do not restart anything, so we are waiting
    4500         // for subsequent event about VBoxSVC is available again.
    4501         m_vbox = virtualBoxClient().GetVirtualBox();
     4504        m_vbox = m_client.GetVirtualBox();
     4505        if (!m_client.isOk())
     4506        {
     4507            // The proper behavior would be to show the message and to exit the app, e.g.:
     4508            // msgCenter().cannotAcquireVirtualBox(m_client);
     4509            // return QApplication::quit();
     4510            // But CVirtualBox is still NULL in current Main implementation,
     4511            // and this call do not restart anything, so we are waiting
     4512            // for subsequent event about VBoxSVC is available again.
     4513        }
    45024514    }
    45034515    /* If VBoxSVC is available: */
     
    45064518        if (!m_fWrappersValid)
    45074519        {
     4520            /* Re-fetch corresponding CVirtualBox: */
     4521            m_vbox = m_client.GetVirtualBox();
     4522            if (!m_client.isOk())
     4523            {
     4524                msgCenter().cannotAcquireVirtualBox(m_client);
     4525                return QApplication::quit();
     4526            }
    45084527            /* Re-init wrappers: */
    45094528            comWrappersReinit();
     
    45264545{
    45274546    /* Re-fetch corresponding objects/values: */
    4528     m_vbox = virtualBoxClient().GetVirtualBox();
    45294547    m_host = virtualBox().GetHost();
    45304548    m_strHomeFolder = virtualBox().GetHomeFolder();
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