VirtualBox

Changeset 55381 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 22, 2015 3:03:44 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 6846: Allow to close the GUI if VBoxHeadless stopped/killed already.

File:
1 edited

Legend:

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

    r53961 r55381  
    339339        if (pCloseDlg->isValid())
    340340        {
    341             /* If VM is not paused and not stuck, we should pause it first: */
    342             bool fWasPaused = uisession()->isPaused() || uisession()->isStuck();
    343             if (fWasPaused || uisession()->pause())
     341            /* We are going to show close-dialog: */
     342            bool fShowCloseDialog = true;
     343            /* Check if VM is paused or stuck: */
     344            const bool fWasPaused = uisession()->isPaused();
     345            const bool fIsStuck = uisession()->isStuck();
     346            /* If VM is NOT paused and NOT stuck: */
     347            if (!fWasPaused && !fIsStuck)
     348            {
     349                /* We should pause it first: */
     350                const bool fIsPaused = uisession()->pause();
     351                /* If we were unable to pause VM: */
     352                if (!fIsPaused)
     353                {
     354                    /* If that is NOT the separate VM process UI: */
     355                    if (!vboxGlobal().isSeparateProcess())
     356                    {
     357                        /* We are not going to show close-dialog: */
     358                        fShowCloseDialog = false;
     359                    }
     360                    /* If that is the separate VM process UI: */
     361                    else
     362                    {
     363                        /* We are going to show close-dialog only
     364                         * if headless frontend stopped/killed already: */
     365                        CMachine machine = uisession()->machine();
     366                        KMachineState machineState = machine.GetState();
     367                        fShowCloseDialog = !machine.isOk() || machineState == KMachineState_Null;
     368                    }
     369                }
     370            }
     371            /* If we are going to show close-dialog: */
     372            if (fShowCloseDialog)
    344373            {
    345374                /* Show close-dialog to let the user make the choice: */
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