From: cyreve Date: Wed, 13 Feb 2008 23:19:14 +0000 (+0000) Subject: bug 190722: crash adding newline to simple text object (gcc4.3+) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=55a048eca6728b0aa813d1cb39f711335d747113;p=inkscape.git bug 190722: crash adding newline to simple text object (gcc4.3+) --- 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 *output_list, std::vector const &parent_list, unsigned parent_offset, std::vector 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()) {