diff options
author | Richard Nelson <none@none> | 2010-07-30 15:17:50 -0700 |
---|---|---|
committer | Richard Nelson <none@none> | 2010-07-30 15:17:50 -0700 |
commit | c60fd88714727a86d5b905c1986bc2ca6013791e (patch) | |
tree | c41da40bbfe02dc2d1441b95e5a0e84cf7dd300b /indra/llui/lltextbase.cpp | |
parent | fbd05e947829714d81278dfa0b138b22e32d56a7 (diff) | |
parent | b95ad3b5cec84387d20d2a1af08eeb090b54b134 (diff) |
merge
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r-- | indra/llui/lltextbase.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 4bcf7e6980..cde08c7b19 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1495,24 +1495,32 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) { + static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment(); + if (index > getLength()) { return mSegments.end(); } // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } //FIXME: avoid operator new somehow (without running into refcount problems) - segment_set_t::iterator it = mSegments.upper_bound(new LLIndexSegment(index)); + index_segment->setStart(index); + index_segment->setEnd(index); + segment_set_t::iterator it = mSegments.upper_bound(index_segment); return it; } LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 index) const { + static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment(); + if (index > getLength()) { return mSegments.end(); } // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } - LLTextBase::segment_set_t::const_iterator it = mSegments.upper_bound(new LLIndexSegment(index)); + index_segment->setStart(index); + index_segment->setEnd(index); + LLTextBase::segment_set_t::const_iterator it = mSegments.upper_bound(index_segment); return it; } |