summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2010-05-19 04:02:17 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2010-05-19 04:02:17 (GMT)
commit2fb3ec5c80a0b9d211c0168fdcd1f4fb84c9b315 (patch)
tree9eaf0842a9cd6f719e2d64866b806a84f57f8e1e /src/gui
parent730bfd80804899771b39998c5b67e604d2192ecd (diff)
parentdcfe68f66e5162f9f7a05552aa1133cdc1f0f9c3 (diff)
downloadQt-2fb3ec5c80a0b9d211c0168fdcd1f4fb84c9b315.zip
Qt-2fb3ec5c80a0b9d211c0168fdcd1f4fb84c9b315.tar.gz
Qt-2fb3ec5c80a0b9d211c0168fdcd1f4fb84c9b315.tar.bz2
Merge remote branch 'origin/4.6' into 4.7-from-4.6
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/util/qcompleter.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 05fe744..1abc2d9 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -532,17 +532,22 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con
QMatchData old = cache[parent].take(part);
cost = cost + m.indices.cost() - old.indices.cost();
if (cost * sizeof(int) > 1024 * 1024) {
- QMap<QModelIndex, CacheItem>::iterator it1 ;
- for (it1 = cache.begin(); it1 != cache.end(); ++it1) {
+ QMap<QModelIndex, CacheItem>::iterator it1 = cache.begin();
+ while (it1 != cache.end()) {
CacheItem& ci = it1.value();
int sz = ci.count()/2;
QMap<QString, QMatchData>::iterator it2 = ci.begin();
- for (int i = 0; it2 != ci.end() && i < sz; i++, ++it2) {
+ int i = 0;
+ while (it2 != ci.end() && i < sz) {
cost -= it2.value().indices.cost();
- ci.erase(it2);
+ it2 = ci.erase(it2);
+ i++;
+ }
+ if (ci.count() == 0) {
+ it1 = cache.erase(it1);
+ } else {
+ ++it1;
}
- if (ci.count() == 0)
- cache.erase(it1);
}
}
@@ -1808,7 +1813,7 @@ QStringList QCompleter::splitPath(const QString& path) const
This signal is sent when an item in the popup() is highlighted by
the user. It is also sent if complete() is called with the completionMode()
- set to QCOmpleter::InlineCompletion. The item's \a text is given.
+ set to QCompleter::InlineCompletion. The item's \a text is given.
*/
QT_END_NAMESPACE