VirtualBox

Changeset 84188 in vbox for trunk/src


Ignore:
Timestamp:
May 7, 2020 2:28:29 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Couple of checks to make sure item is of local type.

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

Legend:

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

    r84102 r84188  
    805805    foreach (UIVirtualMachineItem *pItem, items)
    806806    {
    807         /* Get item state: */
     807        /* But for local machine items only: */
     808        AssertPtrReturnVoid(pItem);
     809        if (pItem->itemType() != UIVirtualMachineItemType_Local)
     810            continue;
     811
     812        /* Get machine item state: */
    808813        const KMachineState enmState = pItem->machineState();
    809814
     
    919924    {
    920925        /* Check if current item could be saved: */
     926        AssertPtrReturnVoid(pItem);
    921927        if (!isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_SaveState, QList<UIVirtualMachineItem*>() << pItem))
    922928            continue;
     
    931937        /* Get session machine: */
    932938        CMachine comMachine = comSession.GetMachine();
     939        /* Get machine item state: */
     940        const KMachineState enmState = pItem->machineState();
    933941        /* Pause VM first if necessary: */
    934         if (pItem->machineState() != KMachineState_Paused)
     942        if (enmState != KMachineState_Paused)
    935943            comConsole.Pause();
    936944        if (comConsole.isOk())
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r83946 r84188  
    9292bool UIChooserItemMachine::isLockedMachine() const
    9393{
    94     const KMachineState enmState = cacheType() == UIVirtualMachineItemType_Local
    95                                  ? cache()->machineState()
    96                                  : KMachineState_Null;
    97     return enmState != KMachineState_PoweredOff &&
    98            enmState != KMachineState_Saved &&
    99            enmState != KMachineState_Teleported &&
    100            enmState != KMachineState_Aborted;
     94    /* For local machines only, others always unlocked: */
     95    if (cacheType() != UIVirtualMachineItemType_Local)
     96        return false;
     97
     98    /* Acquire local machine state: */
     99    const KMachineState enmState = cache()->machineState();
     100    return    enmState != KMachineState_PoweredOff
     101           && enmState != KMachineState_Saved
     102           && enmState != KMachineState_Teleported
     103           && enmState != KMachineState_Aborted;
    101104}
    102105
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