VirtualBox

Changeset 98940 in vbox for trunk


Ignore:
Timestamp:
Mar 13, 2023 4:00:39 PM (19 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: A possibility to close Runtime UI if COM session remains or became invalid.

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

Legend:

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

    r98938 r98940  
    212212           ? machineLogic()->activeMachineWindow()
    213213           : 0;
     214}
     215
     216bool UIMachine::isSessionValid() const
     217{
     218    return uisession() ? uisession()->isValid() : false;
    214219}
    215220
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98926 r98940  
    174174    /** Returns active machine-window reference (if possible). */
    175175    QWidget *activeWindow() const;
     176
     177    /** Returns whether session UI is valid. */
     178    bool isSessionValid() const;
    176179
    177180    /** Returns whether requested visual @a state allowed. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r98849 r98940  
    355355void UIMachineWindow::closeEvent(QCloseEvent *pCloseEvent)
    356356{
     357    /* Fast handling in case if session is invalid: */
     358    if (!uimachine()->isSessionValid())
     359    {
     360        uimachine()->closeRuntimeUI();
     361        return;
     362    }
     363
    357364    /* Always ignore close-event first: */
    358365    pCloseEvent->ignore();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98939 r98940  
    109109    /* Base variables: */
    110110    , m_pMachine(pMachine)
     111    , m_fValid(false)
    111112    , m_pConsoleEventhandler(0)
    112113    /* Common variables: */
     
    201202    uiCommon().createPidfile();
    202203#endif /* VBOX_GUI_WITH_PIDFILE */
     204
     205    /* Mark as valid finally: */
     206    m_fValid = true;
    203207
    204208    /* True by default: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98938 r98940  
    156156        /** Performs session UI intialization. */
    157157        bool initialize();
     158
     159        /** Returns whether session UI is valid. */
     160        bool isValid() const { return m_fValid; }
     161
    158162        /** Powers VM up. */
    159163        bool powerUp();
     
    703707        UIMachine *m_pMachine;
    704708
     709        /** Holds whether session UI is valid. */
     710        bool  m_fValid;
     711
    705712        /** Holds the machine name. */
    706713        QString  m_strMachineName;
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