Fix crash when searching backwards

When searching backwards end is not actually words.end but words.begin (since the loop goes backwards) hence we can't pass end to stringLengthAdaptedWithHyphen
I've now renamed end to loop_end to make it a bit more clear.
BUGS: 309030
FIXED-IN: 4.9.4
This commit is contained in:
Albert Astals Cid 2012-11-02 22:24:23 +01:00
parent 84be046806
commit d59ffb4a7a

View file

@ -953,7 +953,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalBackward( int searchID, const
Qt::CaseSensitivity caseSensitivity,
TextComparisonFunction comparer,
const TextList::ConstIterator &start,
const TextList::ConstIterator &end )
const TextList::ConstIterator &loop_end )
{
const QMatrix matrix = m_page ? m_page->rotationMatrix() : QMatrix();
@ -992,7 +992,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalBackward( int searchID, const
}
else
{
len = stringLengthAdaptedWithHyphen(str, it, end, m_page);
len = stringLengthAdaptedWithHyphen(str, it, m_words.constEnd(), m_page);
int min=qMin(queryLeft,len);
#ifdef DEBUG_TEXTPAGE
kDebug(OkularDebug) << str.right(min) << " : " << _query.mid(j-min+1,min);
@ -1057,7 +1057,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalBackward( int searchID, const
ret->simplify();
return ret;
}
if ( it == end )
if ( it == loop_end )
break;
else
--it;