a9a109
diff -up qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h.QTBUG-22037 qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h
a9a109
--- qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h.QTBUG-22037	2011-10-03 22:44:32.000000000 -0500
a9a109
+++ qt-everywhere-opensource-src-4.8.0/src/corelib/tools/qlist.h	2011-10-15 14:25:52.238694974 -0500
a9a109
@@ -769,26 +769,18 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::clea
a9a109
 template <typename T>
a9a109
 Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t)
a9a109
 {
a9a109
-    int index = indexOf(_t);
a9a109
-    if (index == -1)
a9a109
-        return 0;
a9a109
-
a9a109
+    detachShared();
a9a109
     const T t = _t;
a9a109
-    detach();
a9a109
-
a9a109
-    Node *i = reinterpret_cast<Node *>(p.at(index));
a9a109
-    Node *e = reinterpret_cast<Node *>(p.end());
a9a109
-    Node *n = i;
a9a109
-    node_destruct(i);
a9a109
-    while (++i != e) {
a9a109
-        if (i->t() == t)
a9a109
-            node_destruct(i);
a9a109
-        else
a9a109
-            *n++ = *i;
a9a109
-    }
a9a109
-
a9a109
-    int removedCount = e - n;
a9a109
-    d->end -= removedCount;
a9a109
+    int removedCount=0, i=0;
a9a109
+    Node *n;
a9a109
+    while (i < p.size())
a9a109
+        if ((n = reinterpret_cast<Node *>(p.at(i)))->t() == t) {
a9a109
+            node_destruct(n);
a9a109
+            p.remove(i);
a9a109
+            ++removedCount;
a9a109
+        } else {
a9a109
+            ++i;
a9a109
+        }
a9a109
     return removedCount;
a9a109
 }
a9a109