diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2015-11-25 01:05:31 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2015-11-25 01:05:31 +0000 |
| commit | b2f49404d1fcffc1627c76a1f053a457637de7b3 (patch) | |
| tree | d1cb3d7d172c2d96ce05403e25f254bcbf2e80c1 /src/document.cpp | |
| parent | Use deprecated constant to maintain backwards compatibility with freetype 2.4. (diff) | |
| download | inkscape-b2f49404d1fcffc1627c76a1f053a457637de7b3.tar.gz inkscape-b2f49404d1fcffc1627c76a1f053a457637de7b3.zip | |
fixes infinite loop due to buggy recursion in flattening function
Fixed bugs:
- https://launchpad.net/bugs/1519547
(bzr r14489)
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/document.cpp b/src/document.cpp index 0e49f23e2..23d99d78c 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1337,20 +1337,25 @@ SPItem *SPDocument::getItemFromListAtPointBottom(unsigned int dkey, SPGroup *gro /** Turn the SVG DOM into a flat list of nodes that can be searched from top-down. The list can be persisted, which improves "find at multiple points" speed. +Returns true if upto is reached. */ -static void build_flat_item_list(std::deque<SPItem*> *nodes, unsigned int dkey, SPGroup *group, gboolean into_groups, bool take_insensitive = false, SPItem *upto = NULL) +static bool build_flat_item_list(std::deque<SPItem*> *nodes, unsigned int dkey, SPGroup *group, gboolean into_groups, bool take_insensitive = false, SPItem *upto = NULL) { + bool found_upto = false; for ( SPObject *o = group->firstChild() ; o ; o = o->getNext() ) { if (!SP_IS_ITEM(o)) { continue; } if (upto && SP_ITEM(o) == upto) { + found_upto = true; break; } if (SP_IS_GROUP(o) && (SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER || into_groups)) { - build_flat_item_list(nodes, dkey, SP_GROUP(o), into_groups, take_insensitive, upto); + found_upto = build_flat_item_list(nodes, dkey, SP_GROUP(o), into_groups, take_insensitive, upto); + if (found_upto) + break; } else { SPItem *child = SP_ITEM(o); @@ -1359,6 +1364,7 @@ static void build_flat_item_list(std::deque<SPItem*> *nodes, unsigned int dkey, } } } + return found_upto; } /** |
