summaryrefslogtreecommitdiffstats
path: root/src/gui/util
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-03-25 13:45:55 (GMT)
committerjasplin <qt-info@nokia.com>2009-03-25 13:50:57 (GMT)
commita794ded85f74516239a08cf848e6b4f8b6dcac6a (patch)
treefd8b1df57116bd1f508c48d03bba44725d8e99ce /src/gui/util
parent35528b2109db5832cbd0a4fcde6e6cd1f5bdd6db (diff)
downloadQt-a794ded85f74516239a08cf848e6b4f8b6dcac6a.zip
Qt-a794ded85f74516239a08cf848e6b4f8b6dcac6a.tar.gz
Qt-a794ded85f74516239a08cf848e6b4f8b6dcac6a.tar.bz2
Fix assertion failure in QCompleter::setCompletionPrefix().
Calling setCompletionPrefix() on a QCompleter from a slot connected to the editingFinished() signal of the corresponding QLineEdit could in some cases alter the internal state of the completer in such a way that an assertion would fail. The fix prevents the asserting code from being called in this particular state. Reviewed-by: janarve Task-number: 246056
Diffstat (limited to 'src/gui/util')
-rw-r--r--src/gui/util/qcompleter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 8b07163..aeb7e91 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -824,9 +824,9 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
Q_Q(QCompleter);
QString completion;
- if (!index.isValid())
+ if (!index.isValid() || (index.row() >= proxy->engine->matchCount())) {
completion = prefix;
- else {
+ } else {
QModelIndex si = proxy->mapToSource(index);
si = si.sibling(si.row(), column); // for clicked()
completion = q->pathFromIndex(si);