summaryrefslogtreecommitdiffstats
path: root/src/sp-text.cpp
diff options
context:
space:
mode:
authorRichard Hughes <cyreve@gmail.com>2008-02-13 23:19:14 +0000
committercyreve <cyreve@users.sourceforge.net>2008-02-13 23:19:14 +0000
commit637495a778db254d15643e2cd13d8cf3b2915eae (patch)
treee31a2b95492bd9a9ca292e8808b05deba973a5f5 /src/sp-text.cpp
parentquick fix to OS X packaging script to allow the incorporation of Python in th... (diff)
downloadinkscape-637495a778db254d15643e2cd13d8cf3b2915eae.tar.gz
inkscape-637495a778db254d15643e2cd13d8cf3b2915eae.zip
bug 190722: crash adding newline to simple text object (gcc4.3+)
(bzr r4728)
Diffstat (limited to 'src/sp-text.cpp')
-rw-r--r--src/sp-text.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 5d1abbb3a..810df2530 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -748,11 +748,14 @@ void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs *
void TextTagAttributes::mergeSingleAttribute(std::vector<SVGLength> *output_list, std::vector<SVGLength> const &parent_list, unsigned parent_offset, std::vector<SVGLength> const *overlay_list)
{
+ output_list->clear();
if (overlay_list == NULL) {
- output_list->resize(std::max(0, (int)parent_list.size() - (int)parent_offset));
- std::copy(parent_list.begin() + parent_offset, parent_list.end(), output_list->begin());
+ if (parent_list.size() > parent_offset)
+ {
+ output_list->reserve(parent_list.size() - parent_offset);
+ std::copy(parent_list.begin() + parent_offset, parent_list.end(), std::back_inserter(*output_list));
+ }
} else {
- output_list->clear();
output_list->reserve(std::max((int)parent_list.size() - (int)parent_offset, (int)overlay_list->size()));
unsigned overlay_offset = 0;
while (parent_offset < parent_list.size() || overlay_offset < overlay_list->size()) {