VirtualBox

Changeset 88657 in vbox


Ignore:
Timestamp:
Apr 22, 2021 3:11:09 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161: Rework host logoff handling; VirtualBox Manager is now able to properly shutdown itself, Runtime UI still requires to postpone shutdown until VM state is saved; We now also call for VM state saving functionality directly.

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

Legend:

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

    r88656 r88657  
    40814081{
    40824082    /* Make sure QApplication cleanup us on exit: */
     4083    qApp->setFallbackSessionManagementEnabled(false);
    40834084    connect(qApp, &QGuiApplication::aboutToQuit,
    40844085            this, &UICommon::cleanup);
     
    46994700#endif
    47004701
    4701     /* Ask session manager to postpone shutdown until we done: */
    4702     manager.cancel();
     4702    /* Depending on UI type: */
     4703    switch (uiType())
     4704    {
     4705        /* For Runtime UI: */
     4706        case UIType_RuntimeUI:
     4707        {
     4708            // WORKAROUND:
     4709            // We can't save VM state in one go, so we have to ask session manager to postpone shutdown until we done..
     4710            manager.cancel();
    47034711
    47044712#ifdef VBOX_WS_WIN
    4705     // WORKAROUND:
    4706     // In theory that's Qt5 who should allow us to provide postponing reason as well,
    4707     // but that functionality seems missed in Windows platform plugin, so we are making that ourselves.
    4708     // That also implies that since we had postponed a shutdown process, host will send us WM_QUIT to
    4709     // allow to properly do an application cleanup first. That signal will cause QApplication to quit().
    4710     ShutdownBlockReasonCreateAPI((HWND)windowManager().mainWindowShown()->winId(), L"Shutdown in progress...");
     4713            // WORKAROUND:
     4714            // In theory that's Qt5 who should allow us to provide postponing reason as well, but that functionality
     4715            // seems missed in Windows platform plugin, so we are making that ourselves.  That also implies that since
     4716            // we had postponed a shutdown process, host will send us WM_QUIT to allow to properly do an application
     4717            // cleanup first. That signal will cause QApplication to quit().
     4718            ShutdownBlockReasonCreateAPI((HWND)windowManager().mainWindowShown()->winId(), L"Shutdown in progress...");
    47114719#endif
     4720
     4721            break;
     4722        }
     4723        default:
     4724            break;
     4725    }
    47124726}
    47134727#endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.cpp

    r88656 r88657  
    167167
    168168#ifdef VBOX_RUNTIME_UI
    169     /* Temporary override the default close action to 'SaveState' if necessary: */
    170     if (gpMachine->uisession()->defaultCloseAction() == MachineCloseAction_Invalid)
    171         gpMachine->uisession()->setDefaultCloseAction(MachineCloseAction_SaveState);
     169    gpMachine->uisession()->saveState();
    172170#endif
    173171}
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