VirtualBox

Changeset 101095 in vbox


Ignore:
Timestamp:
Sep 12, 2023 10:55:48 PM (19 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159064
Message:

VBoxDbg: Fixed statistics refresh bug and changed some of QModelIndex returning methods to use Assert() more.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/VBoxDbgStatsQt.cpp

    r99739 r101095  
    8181    /** The node should be refreshed. */
    8282    kDbgGuiStatsNodeState_kRefresh,
     83#if 0 /// @todo not implemented
    8384    /** diff: The node equals. */
    8485    kDbgGuiStatsNodeState_kDiffEqual,
     
    9192    /** diff: The node is only in set 2. */
    9293    kDbgGuiStatsNodeState_kDiffOnlyIn2,
     94#endif
    9395    /** The end of the valid state values. */
    9496    kDbgGuiStatsNodeState_kEnd
     
    18991901    if (m_fUpdateInsertRemove)
    19001902    {
    1901         /* emit layoutChanged(); - hrmpf, doesn't work reliably... */
    1902         beginResetModel();
     1903#if 0 // hrmpf, layoutChanged() didn't work reliably at some point so doing this as well...
     1904        beginResetModel(); 
    19031905        endResetModel();
     1906#else
     1907        emit layoutChanged();
     1908#endif
    19041909    }
    19051910    else
     
    19281933                Assert(Stack.iTop < (int32_t)RT_ELEMENTS(Stack.a));
    19291934                Stack.a[Stack.iTop].pNode = pNode->papChildren[iChild];
    1930                 Stack.a[Stack.iTop].iChild = 0;
     1935                Stack.a[Stack.iTop].iChild = -1;
    19311936            }
    19321937            else
     
    19451950                    if (iChild >= pNode->cChildren)
    19461951                        break;
    1947                     QModelIndex TopLeft = createIndex(iChild, 0, pNode->papChildren[iChild]);
     1952                    QModelIndex const TopLeft = createIndex(iChild, 2, pNode->papChildren[iChild]);
    19481953                    pNode->papChildren[iChild]->enmState = kDbgGuiStatsNodeState_kVisible;
    19491954
    1950                     /* any subsequent nodes that also needs refreshing? */
    1951                     if (   ++iChild < pNode->cChildren
    1952                         && pNode->papChildren[iChild]->enmState == kDbgGuiStatsNodeState_kRefresh)
    1953                     {
    1954                         do  pNode->papChildren[iChild]->enmState = kDbgGuiStatsNodeState_kVisible;
    1955                         while (   ++iChild < pNode->cChildren
    1956                                && pNode->papChildren[iChild]->enmState == kDbgGuiStatsNodeState_kRefresh);
    1957                         QModelIndex BottomRight = createIndex(iChild - 1, DBGGUI_STATS_COLUMNS - 1, pNode->papChildren[iChild - 1]);
    1958 
    1959                         /* emit the refresh signal */
    1960                         emit dataChanged(TopLeft, BottomRight);
    1961                     }
    1962                     else
    1963                     {
    1964                         /* emit the refresh signal */
    1965                         emit dataChanged(TopLeft, TopLeft);
    1966                     }
     1955                    /* Any subsequent nodes that also needs refreshing? */
     1956                    while (   iChild + 1 < pNode->cChildren
     1957                           && pNode->papChildren[iChild + 1]->enmState == kDbgGuiStatsNodeState_kRefresh)
     1958                        iChild++;
     1959
     1960                    /* emit the refresh signal */
     1961                    QModelIndex const BottomRight = createIndex(iChild, DBGGUI_STATS_COLUMNS - 2, pNode->papChildren[iChild]);
     1962                    emit dataChanged(TopLeft, BottomRight);
     1963                    iChild++;
    19671964                }
    19681965            }
     
    21522149{
    21532150    PDBGGUISTATSNODE pParent = nodeFromIndex(a_rParent);
    2154     if (!pParent)
    2155     {
    2156         if (    a_rParent.isValid()
    2157             ||  iRow
    2158             ||  (unsigned)iColumn < DBGGUI_STATS_COLUMNS)
    2159         {
    2160             Assert(!a_rParent.isValid());
    2161             Assert(!iRow);
    2162             Assert((unsigned)iColumn < DBGGUI_STATS_COLUMNS);
    2163             return QModelIndex();
    2164         }
    2165 
    2166         /* root */
    2167         return createIndex(0, iColumn, m_pRoot);
    2168     }
    2169     if ((unsigned)iRow >= pParent->cChildren)
    2170     {
    2171         Log(("index: iRow=%d >= cChildren=%u (iColumn=%d)\n", iRow, (unsigned)pParent->cChildren, iColumn));
    2172         return QModelIndex(); /* bug? */
    2173     }
    2174     if ((unsigned)iColumn >= DBGGUI_STATS_COLUMNS)
    2175     {
    2176         Log(("index: iColumn=%d (iRow=%d)\n", iColumn, iRow));
    2177         return QModelIndex(); /* bug? */
    2178     }
    2179     PDBGGUISTATSNODE pChild = pParent->papChildren[iRow];
    2180     return createIndex(iRow, iColumn, pChild);
     2151    if (pParent)
     2152    {
     2153        AssertMsgReturn((unsigned)iRow < pParent->cChildren,
     2154                        ("iRow=%d >= cChildren=%u (iColumn=%d)\n", iRow, (unsigned)pParent->cChildren, iColumn),
     2155                        QModelIndex());
     2156        AssertMsgReturn((unsigned)iColumn < DBGGUI_STATS_COLUMNS, ("iColumn=%d (iRow=%d)\n", iColumn, iRow), QModelIndex());
     2157
     2158        PDBGGUISTATSNODE pChild = pParent->papChildren[iRow];
     2159        return createIndex(iRow, iColumn, pChild);
     2160    }
     2161
     2162    /* root?  */
     2163    AssertReturn(a_rParent.isValid(), QModelIndex());
     2164    AssertMsgReturn(iRow == 0 && (unsigned)iColumn < DBGGUI_STATS_COLUMNS, ("iRow=%d iColumn=%d", iRow, iColumn), QModelIndex());
     2165    return createIndex(0, iColumn, m_pRoot);
    21812166}
    21822167
     
    24432428{
    24442429    unsigned iCol = a_rIndex.column();
    2445     if (iCol >= DBGGUI_STATS_COLUMNS)
    2446         return QVariant();
     2430    AssertMsgReturn(iCol < DBGGUI_STATS_COLUMNS, ("%d\n", iCol), QVariant());
     2431    Log4(("Model::data(%p(%d,%d), %d)\n", nodeFromIndex(a_rIndex), iCol, a_rIndex.row(), a_eRole));
    24472432
    24482433    if (a_eRole == Qt::DisplayRole)
    24492434    {
    24502435        PDBGGUISTATSNODE pNode = nodeFromIndex(a_rIndex);
    2451         if (!pNode)
    2452             return QVariant();
     2436        AssertReturn(pNode, QVariant());
    24532437
    24542438        switch (iCol)
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