summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-12 03:04:01 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-12 03:04:01 (GMT)
commita4e406277bc6af457d26134d654f17df553330fc (patch)
tree4ba940003a96ef34262ced7f072f8dbb06638ae7 /src
parent7744f0d6bf5a8c4395ecf1a2bfe09c392e8d8cd1 (diff)
parent6fbfb1ab3f26ad672eb24f9b4a0ce1a8eea08298 (diff)
downloadQt-a4e406277bc6af457d26134d654f17df553330fc.zip
Qt-a4e406277bc6af457d26134d654f17df553330fc.tar.gz
Qt-a4e406277bc6af457d26134d654f17df553330fc.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Don't crash on an invalid replacementStart from an input method.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qlinecontrol.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 202ea7a..8d4a90e 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -435,6 +435,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
m_cursor += event->replacementStart();
+ if (m_cursor < 0)
+ m_cursor = 0;
// insert commit string
if (event->replacementLength()) {
@@ -447,7 +449,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
cursorPositionChanged = true;
}
- m_cursor = qMin(c, m_text.length());
+ m_cursor = qBound(0, c, m_text.length());
for (int i = 0; i < event->attributes().size(); ++i) {
const QInputMethodEvent::Attribute &a = event->attributes().at(i);