VirtualBox

Changeset 88740 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 27, 2021 4:52:17 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161: Rework commit data request handling; GUI should NOT initiate state saving itself, VBoxSVC can do it itself; Moreover, if not VBoxSVC, VBoxHeadless would be forced to do it in separate/headless cases.

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

Legend:

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

    r88678 r88740  
    46934693void UICommon::sltHandleCommitDataRequest(QSessionManager &manager)
    46944694{
    4695     LogRel(("GUI: UICommon::sltHandleCommitDataRequest: Emergency shutdown initiated\n"));
     4695    LogRel(("GUI: UICommon: Commit data request..\n"));
    46964696
    46974697    /* Ask listener to commit data: */
     
    47074707        case UIType_RuntimeUI:
    47084708        {
    4709             // WORKAROUND:
    4710             // We can't save VM state in one go, so we have to ask session manager to postpone shutdown until we done..
    4711             manager.cancel();
     4709            /* Thin clients will be able to shutdown properly,
     4710             * but for fat clients: */
     4711            if (!isSeparateProcess())
     4712            {
     4713                // WORKAROUND:
     4714                // We can't save VM state in one go for fat clients, so we have to ask session manager to cancel shutdown.
     4715                // To next major release this should be removed in any case, since there will be no fat clients after all.
     4716                manager.cancel();
    47124717
    47134718#ifdef VBOX_WS_WIN
    4714             // WORKAROUND:
    4715             // In theory that's Qt5 who should allow us to provide postponing reason as well, but that functionality
    4716             // seems missed in Windows platform plugin, so we are making that ourselves.  That also implies that since
    4717             // we had postponed a shutdown process, host will send us WM_QUIT to allow to properly do an application
    4718             // cleanup first. That signal will cause QApplication to quit().
    4719             ShutdownBlockReasonCreateAPI((HWND)windowManager().mainWindowShown()->winId(), L"Shutdown in progress...");
     4719                // WORKAROUND:
     4720                // In theory that's Qt5 who should allow us to provide canceling reason as well, but that functionality
     4721                // seems to be missed in Windows platform plugin, so we are making that ourselves.
     4722                ShutdownBlockReasonCreateAPI((HWND)windowManager().mainWindowShown()->winId(), L"VM is still running.");
    47204723#endif
     4724            }
    47214725
    47224726            break;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.cpp

    r88664 r88740  
    7676    connect(&uiCommon(), &UICommon::sigAskToCloseUI,
    7777            this, &UIStarter::sltCloseUI);
    78     connect(&uiCommon(), &UICommon::sigAskToCommitData,
    79             this, &UIStarter::sltHandleCommitDataRequest);
    8078}
    8179
     
    8785    disconnect(&uiCommon(), &UICommon::sigAskToCloseUI,
    8886               this, &UIStarter::sltCloseUI);
    89     disconnect(&uiCommon(), &UICommon::sigAskToCommitData,
    90                this, &UIStarter::sltHandleCommitDataRequest);
    9187}
    9288
     
    159155#endif
    160156}
    161 
    162 void UIStarter::sltHandleCommitDataRequest()
    163 {
    164     /* Exit if UICommon is not valid: */
    165     if (!uiCommon().isValid())
    166         return;
    167 
    168 #ifdef VBOX_RUNTIME_UI
    169     /* Only for the case when we have this request
    170      * earlier than the usual cleanup started: */
    171     if (!UICommon::isCleaningUp())
    172         gpMachine->uisession()->saveState();
    173 #endif
    174 }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.h

    r88656 r88740  
    6060    void sltCloseUI();
    6161
    62     /** Handles commit data request. */
    63     void sltHandleCommitDataRequest();
    64 
    6562private:
    6663
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