The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 88eae0661197c3ff1a607ac338ee8aa536a054cb
Author: Vincent van Ravesteijn <v...@lyx.org>
Date:   Sun Apr 28 14:44:08 2013 +0200

    Fix FontIterator to not access pos >= par.size()
    
    An iterator is typicall incremented passed the valid data into the 'end'
    state. However, if this means that other functions are called with invalid
    parameter, we should fix this.
    
    This explains why fontSpan was called with pos==size() while this was not
    expected to happen.
    
    This patch reverts partly f5ad0c128aec (Jean-Marc Lasgouttes; Get rid of
    annoying warning message).

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index ded92f5..6fc44a0 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1830,13 +1830,7 @@ Font const & Paragraph::getFontSettings(BufferParams 
const & bparams,
 
 FontSpan Paragraph::fontSpan(pos_type pos) const
 {
-       LBUFERR(pos <= size());
-
-       // Last position is a special case. I suspect that it would
-       // actually make sense to extend the last font span to cover
-       // the last character (JMarc)
-       if (pos == size())
-               return FontSpan(pos, pos);
+       LBUFERR(pos < size());
 
        pos_type start = 0;
        FontList::const_iterator cit = d->fontlist_.begin();
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index d0f9b3d..4e70dc0 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -771,7 +771,7 @@ public:
        FontIterator & operator++()
        {
                ++pos_;
-               if (pos_ > endspan_ || pos_ == bodypos_) {
+               if (pos_ < par_.size() && (pos_ > endspan_ || pos_ == 
bodypos_)) {
                        font_ = tm_.displayFont(pit_, pos_);
                        endspan_ = par_.fontSpan(pos_).last;
                }

-----------------------------------------------------------------------

Summary of changes:
 src/Paragraph.cpp   |    8 +-------
 src/TextMetrics.cpp |    2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to