OSDN Git Service

debugger: fix recently introduced off-by-one in gdbmi child parsing
authorhjk <qtc-committer@nokia.com>
Tue, 12 Oct 2010 09:30:34 +0000 (11:30 +0200)
committerhjk <qtc-committer@nokia.com>
Tue, 12 Oct 2010 09:31:15 +0000 (11:31 +0200)
Reviewed-by: Friedemann Kleint
src/plugins/debugger/watchutils.cpp

index 2c19820..dd0a1df 100644 (file)
@@ -1708,10 +1708,10 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
     setWatchDataChildCount(childtemplate, item.findChild("childnumchild"));
     //qDebug() << "CHILD TEMPLATE:" << childtemplate.toString();
 
-    int i = 0;
-    foreach (const GdbMi &child, children.children()) {
+    for (int i = 0, n = children.children().size(); i != n; ++i) {
+        const GdbMi &child = children.children().at(i);
         WatchData data1 = childtemplate;
-        data1.sortId = i++;
+        data1.sortId = i;
         GdbMi name = child.findChild("name");
         if (name.isValid())
             data1.name = _(name.data());