VirtualBox

Changeset 72363 in vbox for trunk/src


Ignore:
Timestamp:
May 28, 2018 4:49:10 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Fix for manual application quit procedure preventing it from quitting in some unwanted cases, like when there is startup error or other kind of warning shown before the UI is.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

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

    r72360 r72363  
    481481                break;
    482482
    483             /* For Runtime UI: */
    484             if (vboxGlobal().isVMConsoleProcess())
    485             {
    486                 /* Prevent application from exiting when all window(s) closed: */
    487                 qApp->setQuitOnLastWindowClosed(false);
    488             }
     483            // WORKAROUND:
     484            // Initially we wanted to make that workaround for Runtime UI only,
     485            // because only there we had a strict handling for proper application quit
     486            // procedure.  But it appeared on X11 (as usually due to an async nature) there
     487            // can happen situations that Qt application is checking whether at least one
     488            // window is already shown and if not - exits prematurely _before_ it is actually
     489            // shown.  That can happen for example if window is not yet shown because blocked
     490            // by startup error message-box which is not treated as real window by some
     491            // reason.  So we are making application exit manual everywhere.
     492            qApp->setQuitOnLastWindowClosed(false);
    489493
    490494            /* Request to Start UI _after_ QApplication executed: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r71374 r72363  
    142142}
    143143
     144void UIMachine::closeRuntimeUI()
     145{
     146    /* Quit application: */
     147    QApplication::quit();
     148}
     149
    144150void UIMachine::sltChangeVisualState(UIVisualStateType visualState)
    145151{
     
    304310    /* Cleanup session UI: */
    305311    cleanupSession();
    306 
    307     /* Quit application: */
    308     QApplication::quit();
    309312}
    310313
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r69500 r72363  
    7171
    7272    /** Close Runtime UI. */
    73     void closeRuntimeUI() { destroy(); }
     73    void closeRuntimeUI();
    7474
    7575private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r72257 r72363  
    14171417#endif /* VBOX_WS_MAC */
    14181418
     1419void UISelectorWindow::closeEvent(QCloseEvent *pEvent)
     1420{
     1421    /* Call to base-class: */
     1422    QIWithRetranslateUI<QIMainWindow>::closeEvent(pEvent);
     1423
     1424    /* Quit application: */
     1425    QApplication::quit();
     1426}
     1427
    14191428void UISelectorWindow::prepare()
    14201429{
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h

    r71644 r72363  
    224224      * @{ */
    225225        /** Handles translation event. */
    226         virtual void retranslateUi();
    227 
    228         /** Handles any Qt @a pEvent. */
    229         virtual bool event(QEvent *pEvent);
    230         /** Handles Qt show @a pEvent. */
    231         virtual void showEvent(QShowEvent *pEvent);
    232         /** Handles first Qt show @a pEvent. */
    233         virtual void polishEvent(QShowEvent *pEvent);
     226        virtual void retranslateUi() /* override */;
     227
     228        /** Handles any @a pEvent. */
     229        virtual bool event(QEvent *pEvent) /* override */;
     230        /** Handles show @a pEvent. */
     231        virtual void showEvent(QShowEvent *pEvent) /* override */;
     232        /** Handles first show @a pEvent. */
     233        virtual void polishEvent(QShowEvent *pEvent) /* override */;
    234234#ifdef VBOX_WS_MAC
    235         /** Mac OS X: Preprocesses any Qt @a pEvent for passed @a pObject. */
    236         virtual bool eventFilter(QObject *pObject, QEvent *pEvent);
    237 #endif /* VBOX_WS_MAC */
     235        /** Mac OS X: Preprocesses any @a pEvent for passed @a pObject. */
     236        virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
     237#endif
     238        /** Handles close @a pEvent. */
     239        virtual void closeEvent(QCloseEvent *pEvent) /* override */;
    238240    /** @} */
    239241
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