gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11369: Fix segfault in TextField.cp


From: Bob Naugle
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11369: Fix segfault in TextField.cpp
Date: Wed, 05 Aug 2009 11:08:39 -0600
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11369
committer: Bob Naugle <address@hidden>
branch nick: trunk
timestamp: Wed 2009-08-05 11:08:39 -0600
message:
  Fix segfault in TextField.cpp
modified:
  libcore/TextField.cpp
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2009-08-04 22:17:22 +0000
+++ b/libcore/TextField.cpp     2009-08-05 17:08:39 +0000
@@ -311,8 +311,10 @@
     y = record.yOffset() - record.textHeight() + getLeading();
     h = record.textHeight();
 
-    for (unsigned int p = 0 ; p < (m_cursor - _recordStarts[i]); ++p) {
-        x += record.glyphs()[p].advance;
+    if (!record.glyphs().empty()) {
+        for (unsigned int p = 0 ; p < (m_cursor - _recordStarts[i]); ++p) {
+            x += record.glyphs()[p].advance;
+        }
     }
 
     const std::vector<point> box = boost::assign::list_of
@@ -1443,7 +1445,9 @@
     }
 
     // Add the last line to our output.
-    _textRecords.push_back(rec);
+    if (!rec.glyphs().empty()) {
+        _textRecords.push_back(rec);
+    }
     
     scrollLines();
 
@@ -2097,7 +2101,7 @@
                         last_line.clearGlyphs(1);
                         //record the new line start
                         //
-                        const size_t currentPos = it - _text.begin();
+                        const size_t currentPos = _glyphcount;
                         while (linestartit != linestartend &&
                                 *linestartit + 1 <= currentPos)
                         {
@@ -2123,7 +2127,7 @@
                     
                     // record the position at the start of this line as
                     // a line_start
-                    const size_t linestartpos = (it - _text.begin()) -
+                    const size_t linestartpos = _glyphcount -
                             rec.glyphs().size();
 
                     while (linestartit < linestartend &&


reply via email to

[Prev in Thread] Current Thread [Next in Thread]