VirtualBox

Changeset 88656 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 22, 2021 2:55:38 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143970
Message:

FE/Qt: bugref:8161: Change application shutdown order; The old approach was to close GUI, then detach COM and do the rest of cleanup; Now we are detaching COM first to let VBoxSVC go, then closing GUI and do the rest of cleanup.

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

Legend:

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

    r88441 r88656  
    283283    : m_enmType(enmType)
    284284    , m_fValid(false)
     285#ifdef VBOX_WS_WIN
     286    , m_fDataCommitted(false)
     287#endif
    285288#ifdef VBOX_WS_MAC
    286289    , m_enmMacOSVersion(MacOSXRelease_Old)
     
    40784081{
    40794082    /* Make sure QApplication cleanup us on exit: */
    4080     connect(qApp, &QGuiApplication::aboutToQuit, this, &UICommon::cleanup);
     4083    connect(qApp, &QGuiApplication::aboutToQuit,
     4084            this, &UICommon::cleanup);
    40814085#ifndef VBOX_GUI_WITH_CUSTOMIZATIONS1
    40824086    /* Make sure we handle host OS session shutdown as well: */
     
    45704574void UICommon::cleanup()
    45714575{
     4576    LogRel(("GUI: UICommon: Handling aboutToQuit request..\n"));
     4577
     4578#ifdef VBOX_WS_WIN
     4579    /* Ask listeners to commit data if haven't yet: */
     4580    if (!m_fDataCommitted)
     4581    {
     4582        emit sigAskToCommitData();
     4583        m_fDataCommitted = true;
     4584    }
     4585#else
     4586    /* Ask listeners to commit data: */
     4587    emit sigAskToCommitData();
     4588#endif
     4589
    45724590    /// @todo Shouldn't that be protected with a mutex or something?
    45734591    /* Remember that the cleanup is in progress preventing any unwanted
     
    46544672    m_comCleanupProtectionToken.unlock();
    46554673
     4674    /* Notify listener it can close UI now: */
     4675    emit sigAskToCloseUI();
     4676
    46564677    /* Destroy popup-center: */
    46574678    UIPopupCenter::destroy();
     
    46634684
    46644685    m_fValid = false;
     4686
     4687    LogRel(("GUI: UICommon: aboutToQuit request handled!\n"));
    46654688}
    46664689
     
    46724695    /* Ask listener to commit data: */
    46734696    emit sigAskToCommitData();
     4697#ifdef VBOX_WS_WIN
     4698    m_fDataCommitted = true;
     4699#endif
    46744700
    46754701    /* Ask session manager to postpone shutdown until we done: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r86986 r88656  
    8181        /** Asks #UIStarter listener to restart UI. */
    8282        void sigAskToRestartUI();
     83        /** Asks #UIStarter listener to close UI. */
     84        void sigAskToCloseUI();
    8385
    8486        /** Notifies listeners about the VBoxSVC availability change. */
     
    839841        bool  m_fValid;
    840842
     843#ifdef VBOX_WS_WIN
     844        /** Holds whether overall GUI data is committed. */
     845        bool  m_fDataCommitted;
     846#endif
     847
    841848#ifdef VBOX_WS_MAC
    842849        /** Mac OS X: Holds the #MacOSXRelease determined using <i>uname</i> call. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.cpp

    r82968 r88656  
    6161    /* Assign instance: */
    6262    s_pInstance = this;
    63 
    64     /* Prepare: */
    65     prepare();
    6663}
    6764
    6865UIStarter::~UIStarter()
    6966{
    70     /* Cleanup: */
    71     cleanup();
    72 
    7367    /* Unassign instance: */
    7468    s_pInstance = 0;
     
    8074    connect(&uiCommon(), &UICommon::sigAskToRestartUI,
    8175            this, &UIStarter::sltRestartUI);
     76    connect(&uiCommon(), &UICommon::sigAskToCloseUI,
     77            this, &UIStarter::sltCloseUI);
    8278    connect(&uiCommon(), &UICommon::sigAskToCommitData,
    8379            this, &UIStarter::sltHandleCommitDataRequest);
     
    8985    disconnect(&uiCommon(), &UICommon::sigAskToRestartUI,
    9086               this, &UIStarter::sltRestartUI);
     87    disconnect(&uiCommon(), &UICommon::sigAskToCloseUI,
     88               this, &UIStarter::sltCloseUI);
    9189    disconnect(&uiCommon(), &UICommon::sigAskToCommitData,
    9290               this, &UIStarter::sltHandleCommitDataRequest);
    93 }
    94 
    95 void UIStarter::prepare()
    96 {
    97     /* Listen for QApplication signals: */
    98     connect(qApp, &QGuiApplication::aboutToQuit,
    99             this, &UIStarter::cleanup);
    10091}
    10192
     
    156147}
    157148
    158 void UIStarter::cleanup()
     149void UIStarter::sltCloseUI()
    159150{
    160151#ifndef VBOX_RUNTIME_UI
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.h

    r82968 r88656  
    5353private slots:
    5454
    55     /** Prepares everything. */
    56     void prepare();
    57 
    5855    /** Starts corresponding part of the UI. */
    5956    void sltStartUI();
    6057    /** Restarts corresponding part of the UI. */
    6158    void sltRestartUI();
    62 
    63     /** Cleanups everything. */
    64     void cleanup();
     59    /** Closes corresponding part of the UI. */
     60    void sltCloseUI();
    6561
    6662    /** Handles commit data request. */
Note: See TracChangeset for help on using the changeset viewer.

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