VirtualBox

Changeset 92207 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 4, 2021 8:19:14 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148038
Message:

FE/Qt: Deallocating QItemEditorFactory instance to fix some small leakage.

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

Legend:

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

    r87432 r92207  
    792792    , m_pTableView(0)
    793793    , m_pToolBar(0)
     794    , m_pNewItemEditorFactory(0)
    794795    , m_pTableModel(0)
    795796    , m_pActionAdd(0)
     
    799800    /* Prepare: */
    800801    prepare();
     802}
     803
     804UIPortForwardingTable::~UIPortForwardingTable()
     805{
     806    delete m_pNewItemEditorFactory;
    801807}
    802808
     
    11181124        {
    11191125            /* Create new item editor factory: */
    1120             QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
    1121             if (pNewItemEditorFactory)
     1126            m_pNewItemEditorFactory = new QItemEditorFactory;
     1127            if (m_pNewItemEditorFactory)
    11221128            {
    11231129                /* Register NameEditor as the NameData editor: */
    11241130                int iNameId = qRegisterMetaType<NameData>();
    11251131                QStandardItemEditorCreator<NameEditor> *pNameEditorItemCreator = new QStandardItemEditorCreator<NameEditor>();
    1126                 pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
     1132                m_pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
    11271133
    11281134                /* Register ProtocolEditor as the KNATProtocol editor: */
    11291135                int iProtocolId = qRegisterMetaType<KNATProtocol>();
    11301136                QStandardItemEditorCreator<ProtocolEditor> *pProtocolEditorItemCreator = new QStandardItemEditorCreator<ProtocolEditor>();
    1131                 pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
     1137                m_pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
    11321138
    11331139                /* Register IPv4Editor/IPv6Editor as the IpData editor: */
     
    11361142                {
    11371143                    QStandardItemEditorCreator<IPv4Editor> *pIPv4EditorItemCreator = new QStandardItemEditorCreator<IPv4Editor>();
    1138                     pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
     1144                    m_pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
    11391145                }
    11401146                else
    11411147                {
    11421148                    QStandardItemEditorCreator<IPv6Editor> *pIPv6EditorItemCreator = new QStandardItemEditorCreator<IPv6Editor>();
    1143                     pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
     1149                    m_pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
    11441150                }
    11451151
     
    11471153                int iPortId = qRegisterMetaType<PortData>();
    11481154                QStandardItemEditorCreator<PortEditor> *pPortEditorItemCreator = new QStandardItemEditorCreator<PortEditor>();
    1149                 pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
     1155                m_pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
    11501156
    11511157                /* Set newly created item editor factory for table delegate: */
    1152                 pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
     1158                pStyledItemDelegate->setItemEditorFactory(m_pNewItemEditorFactory);
    11531159            }
    11541160        }
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h

    r91509 r92207  
    3636class QAction;
    3737class QHBoxLayout;
     38class QItemEditorFactory;
    3839class QIDialogButtonBox;
    3940class QITableView;
    4041class UIPortForwardingModel;
    4142class QIToolBar;
    42 
    4343
    4444/** QString subclass used to distinguish name data from simple QString. */
     
    211211      * @param  fAllowEmptyGuestIPs  Brings whether this table allows empty guest IPs. */
    212212    UIPortForwardingTable(const UIPortForwardingDataList &rules, bool fIPv6, bool fAllowEmptyGuestIPs);
    213 
     213    ~UIPortForwardingTable();
    214214    /** Returns the list of port forwarding rules. */
    215215    UIPortForwardingDataList rules() const;
     
    293293    /** Holds the tool-bar instance. */
    294294    QIToolBar   *m_pToolBar;
     295    /** Holds the item editor factory instance. */
     296    QItemEditorFactory *m_pNewItemEditorFactory;
    295297
    296298    /** Holds the table-model instance. */
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