VirtualBox

Changeset 99444 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 18, 2023 3:02:55 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156905
Message:

FE/Qt: Fixed Q_ASSERT issues in UIPortForwardingModel::setRules when working with with empty rule lists (both original and new).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp

    r98103 r99444  
    564564{
    565565    /* Clear old data first of all: */
    566     beginRemoveRows(QModelIndex(), 0, m_dataList.size() - 1);
    567     foreach (const UIPortForwardingRow *pRow, m_dataList)
    568         delete pRow;
    569     m_dataList.clear();
    570     endRemoveRows();
     566    if (!m_dataList.isEmpty())
     567    {
     568        beginRemoveRows(QModelIndex(), 0, m_dataList.size() - 1);
     569        foreach (const UIPortForwardingRow *pRow, m_dataList)
     570            delete pRow;
     571        m_dataList.clear();
     572        endRemoveRows();
     573    }
    571574
    572575    /* Fetch incoming data: */
    573     beginInsertRows(QModelIndex(), 0, newRules.size() - 1);
    574     foreach (const UIDataPortForwardingRule &rule, newRules)
    575         m_dataList << new UIPortForwardingRow(qobject_cast<QITableView*>(parent()),
    576                                               rule.name, rule.protocol,
    577                                               rule.hostIp, rule.hostPort,
    578                                               rule.guestIp, rule.guestPort);
    579     endInsertRows();
     576    if (!newRules.isEmpty())
     577    {
     578        beginInsertRows(QModelIndex(), 0, newRules.size() - 1);
     579        foreach (const UIDataPortForwardingRule &rule, newRules)
     580            m_dataList << new UIPortForwardingRow(qobject_cast<QITableView*>(parent()),
     581                                                  rule.name, rule.protocol,
     582                                                  rule.hostIp, rule.hostPort,
     583                                                  rule.guestIp, rule.guestPort);
     584        endInsertRows();
     585    }
    580586}
    581587
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette