summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-07-28 12:15:28 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-07-28 13:03:04 (GMT)
commit22995948cd3f46780be5d8016708aeef0cd7b066 (patch)
tree370e4d686af16c2299274e785bbaccb92aa188e8 /src
parentcc500b182e26d53ca16136f24a06a111f4374425 (diff)
downloadQt-22995948cd3f46780be5d8016708aeef0cd7b066.zip
Qt-22995948cd3f46780be5d8016708aeef0cd7b066.tar.gz
Qt-22995948cd3f46780be5d8016708aeef0cd7b066.tar.bz2
Revert binary search in QTextEngine::findItem
It's part of c9607f069f0fb98021daf0af9f1d1b2981018e0c which caused crash in certain cases. Task-number: QTBUG-17209 Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 6c13eae..cff3641 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1577,19 +1577,13 @@ bool QTextEngine::isRightToLeft() const
int QTextEngine::findItem(int strPos) const
{
itemize();
- int left = 0;
- int right = layoutData->items.size()-1;
- while(left <= right) {
- int middle = ((right-left)/2)+left;
- if (strPos > layoutData->items[middle].position)
- left = middle+1;
- else if(strPos < layoutData->items[middle].position)
- right = middle-1;
- else {
- return middle;
- }
+
+ int item;
+ for (item = layoutData->items.size()-1; item > 0; --item) {
+ if (layoutData->items[item].position <= strPos)
+ break;
}
- return right;
+ return item;
}
QFixed QTextEngine::width(int from, int len) const