summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-17 15:59:49 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-17 15:59:49 (GMT)
commit803c7c3ff783ca74bc75fe574a98db51e2de9f22 (patch)
tree4d637736ab7adb9df04057cdc930479092d745b3 /src/gui
parent509ef11ab4ba6165c16d9d311c4a1bf7cdfd2528 (diff)
parent8aff2b3e6f09b446f124b7023485e947ab1bf24b (diff)
downloadQt-803c7c3ff783ca74bc75fe574a98db51e2de9f22.zip
Qt-803c7c3ff783ca74bc75fe574a98db51e2de9f22.tar.gz
Qt-803c7c3ff783ca74bc75fe574a98db51e2de9f22.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Doc: fix typo QCompleter: fix misuse of QMap that can lead to crashes qmake: added possibility to specify the type of an install target
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 cefdb27..9a99abe 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -527,17 +527,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);
}
}
@@ -1748,7 +1753,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