VirtualBox

Changeset 77598 in vbox


Ignore:
Timestamp:
Mar 7, 2019 1:51:44 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129225
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Chooser pane: Fixing crash on all machine items removal from existing group (group being dismissed).

File:
1 edited

Legend:

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

    r77596 r77598  
    383383            {
    384384                pItem = navigationList().at(idxBefore);
    385                 if (!currentItems().contains(pItem))
     385                if (!currentItems().contains(pItem) && pItem->type() == UIChooserItemType_Machine)
    386386                    return pItem;
    387387                --idxBefore;
     
    390390            {
    391391                pItem = navigationList().at(idxAfter);
    392                 if (!currentItems().contains(pItem))
     392                if (!currentItems().contains(pItem) && pItem->type() == UIChooserItemType_Machine)
    393393                    return pItem;
    394394                ++idxAfter;
     
    705705            if (uId == m_uLastCreatedMachineId)
    706706            {
    707                 setCurrentItem(root()->searchForItem(comMachine.GetName(),
    708                                                      UIChooserItemSearchFlag_Machine |
    709                                                      UIChooserItemSearchFlag_ExactName));
    710             }
    711         }
     707            setCurrentItem(root()->searchForItem(comMachine.GetName(),
     708                                                 UIChooserItemSearchFlag_Machine |
     709                                                 UIChooserItemSearchFlag_ExactName));
     710        }
     711    }
    712712    }
    713713    /* Existing VM unregistered? */
     
    970970
    971971    /* And update model: */
    972     updateNavigation();
    973     updateLayout();
    974 
    975     /* Make sure at least one item selected after that: */
    976     if (!currentItem() && !navigationList().isEmpty())
    977         setCurrentItem(navigationList().first());
     972        updateNavigation();
     973        updateLayout();
     974
     975        /* Make sure at least one item selected after that: */
     976        if (!currentItem() && !navigationList().isEmpty())
     977            setCurrentItem(navigationList().first());
    978978
    979979    /* Notify listeners about selection change: */
     
    10041004    QList<UIChooserItemMachine*> inaccessibleMachineItemList;
    10051005    UIChooserItemMachine::enumerateMachineItems(currentItems(), inaccessibleMachineItemList,
    1006                                                  UIChooserItemMachineEnumerationFlag_Unique |
    1007                                                  UIChooserItemMachineEnumerationFlag_Inaccessible);
     1006                                                UIChooserItemMachineEnumerationFlag_Unique |
     1007                                                UIChooserItemMachineEnumerationFlag_Inaccessible);
    10081008
    10091009    /* For each machine-item: */
     
    16111611
    16121612    /* Add all the approved machines we have into the group-tree: */
    1613     LogRelFlow(("UIChooserModel: Loading VMs...\n"));
     1613        LogRelFlow(("UIChooserModel: Loading VMs...\n"));
    16141614    foreach (CMachine machine, vboxGlobal().virtualBox().GetMachines())
    1615     {
     1615        {
    16161616        const QUuid uMachineID = machine.GetId();
    1617         if (!uMachineID.isNull() && gEDataManager->showMachineInSelectorChooser(uMachineID))
     1617            if (!uMachineID.isNull() && gEDataManager->showMachineInSelectorChooser(uMachineID))
    16181618            addMachineIntoTheTree(machine);
    1619     }
    1620     LogRelFlow(("UIChooserModel: VMs loaded.\n"));
    1621 }
     1619        }
     1620        LogRelFlow(("UIChooserModel: VMs loaded.\n"));
     1621    }
    16221622
    16231623void UIChooserModel::addMachineIntoTheTree(const CMachine &machine, bool fMakeItVisible /* = false */)
     
    16411641        const QString strGroups = groupList.join(", ");
    16421642        LogRelFlow(("UIChooserModel:  VM {%s} has groups: {%s}.\n", strName.toUtf8().constData(),
    1643                                                                      strGroups.toUtf8().constData()));
     1643                                                                    strGroups.toUtf8().constData()));
    16441644        foreach (QString strGroup, groups)
    16451645        {
     
    16491649            /* Create machine-item with found group-item as parent: */
    16501650            LogRelFlow(("UIChooserModel:   Creating item for VM {%s} in group {%s}.\n", strName.toUtf8().constData(),
    1651                                                                                          strGroup.toUtf8().constData()));
     1651                                                                                        strGroup.toUtf8().constData()));
    16521652            createMachineItem(machine, getGroupItem(strGroup, root(), fMakeItVisible));
    16531653        }
     
    16761676        if (!pParent->isRoot())
    16771677            delete pParent;
    1678     }
    1679 }
     1678            }
     1679        }
    16801680
    16811681bool UIChooserModel::isGlobalItemFavorite(UIChooserItem *pParentItem) const
     
    17341734                        pFoundGroupItem->open(false);
    17351735                return pFoundItem;
    1736             }
    1737         }
    1738     }
     1736        }
     1737    }
     1738}
    17391739
    17401740    /* Found nothing? Creating: */
     
    20722072    foreach (UIChooserItem *pItem, pParentItem->items(UIChooserItemType_Machine))
    20732073        orders[strExtraDataKey] << QString("m=%1").arg(toOldStyleUuid(pItem->toMachineItem()->id()));
    2074 }
     2074    }
    20752075
    20762076void UIChooserModel::makeSureGroupDefinitionsSaveIsFinished()
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