From 058e95a59ccb2ab1748392acdfdbbffd516c9c81 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Mon, 11 Jul 2016 14:24:52 +0200 Subject: First part of new SPObject children list (bzr r14954.1.17) --- src/uri-references.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index db46a156f..078834131 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -92,7 +92,7 @@ bool URIReference::_acceptObject(SPObject *obj) const g_warning("cloned object with no known type\n"); return false; } - for (int i = positions.size() - 2; i >= 0; i--) + for (int i = (int) (positions.size() - 2); i >= 0; i--) owner = owner->childList(false)[positions[i]]; } // once we have the "original" object (hopefully) we look at who is referencing it -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/uri-references.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 078834131..23802ae65 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -76,10 +76,11 @@ bool URIReference::_acceptObject(SPObject *obj) const std::vector positions; while (owner->cloned) { int position = 0; - SPObject *c = owner->parent->firstChild(); - while (c != owner && dynamic_cast(c)) { + for (auto &child: owner->parent->_children) { + if(&child == owner) { + break; + } position++; - c = c->next; } positions.push_back(position); owner = owner->parent; -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/uri-references.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 23802ae65..6ef933982 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -76,7 +76,7 @@ bool URIReference::_acceptObject(SPObject *obj) const std::vector positions; while (owner->cloned) { int position = 0; - for (auto &child: owner->parent->_children) { + for (auto &child: owner->parent->children) { if(&child == owner) { break; } -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/uri-references.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index db46a156f..d626d0e41 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -12,7 +12,6 @@ #include #include -#include #include "document.h" #include "sp-object.h" @@ -21,7 +20,6 @@ #include "extract-uri.h" #include "sp-tag-use.h" #include -#include namespace Inkscape { -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/uri-references.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index d626d0e41..db46a156f 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -12,6 +12,7 @@ #include #include +#include #include "document.h" #include "sp-object.h" @@ -20,6 +21,7 @@ #include "extract-uri.h" #include "sp-tag-use.h" #include +#include namespace Inkscape { -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/uri-references.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index db46a156f..d626d0e41 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -12,7 +12,6 @@ #include #include -#include #include "document.h" #include "sp-object.h" @@ -21,7 +20,6 @@ #include "extract-uri.h" #include "sp-tag-use.h" #include -#include namespace Inkscape { -- cgit v1.2.3 From 71f7e3e517b5d7f87d30a27b683c57df05ab5368 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 27 Oct 2016 02:01:14 +0200 Subject: Fix regression in loop prevention Fixed bugs: - https://launchpad.net/bugs/1636533 (bzr r15193) --- src/uri-references.cpp | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 07f2d168b..170c98beb 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -3,6 +3,7 @@ * * Authors: * Lauris Kaplinski + * Marc Jeanmougin * * Copyright (C) 2001-2002 Lauris Kaplinski * Copyright (C) 2001 Ximian, Inc. @@ -48,13 +49,10 @@ URIReference::~URIReference() { detach(); } * The main ideas here are: * (1) "If we are inside a clone, then we can accept if and only if our "original thing" can accept the reference" * (this caused problems when there are clones because a change in ids triggers signals for the object hrefing this id, - *but also its cloned reprs - * (descendants of referencing an ancestor of the href'ing object)). The way it is done here is *atrocious*, but i - *could not find a better way. - * FIXME: find a better and safer way to find the "original object" of anyone with the flag ->cloned + * but also its cloned reprs(descendants of referencing an ancestor of the href'ing object)). * * (2) Once we have an (potential owner) object, it can accept a href to obj, iff the graph of objects where directed - *edges are + * edges are * either parent->child relations , *** or href'ing to href'ed *** relations, stays acyclic. * We can go either from owner and up in the tree, or from obj and down, in either case this will be in the worst case *linear in the number of objects. @@ -70,29 +68,17 @@ bool URIReference::_acceptObject(SPObject *obj) const SPObject *owner = getOwner(); if (!owner) return true; + while (owner->cloned) { - std::vector positions; - while (owner->cloned) { - int position = 0; - for (auto &child: owner->parent->children) { - if(&child == owner) { - break; - } - position++; - } - positions.push_back(position); + if(!owner->clone_original)//happens when the clone is existing and linking to something, even before the original objects exists. + //for instance, it can happen when you paste a filtered object in a already cloned group: The construction of the + //clone representation of the filtered object will finish before the original object, so the cloned repr will + //have to _accept the filter even though the original does not exist yet. In that case, we'll accept iff the parent of the + //original can accept it: loops caused by other relations than parent-child would be prevented when created on their base object. + //Fixes bug 1636533. owner = owner->parent; - } - if (dynamic_cast(owner)) - owner = ((SPUse *)owner)->get_original(); - else if (dynamic_cast(owner)) - owner = ((SPTagUse *)owner)->get_original(); - else { - g_warning("cloned object with no known type\n"); - return false; - } - for (int i = (int) (positions.size() - 2); i >= 0; i--) - owner = owner->childList(false)[positions[i]]; + else + owner = owner->clone_original; } // once we have the "original" object (hopefully) we look at who is referencing it if (obj == owner) -- cgit v1.2.3 From 349536d49558ec5841e799eb33a4cbbb3fa9722d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 5 Feb 2017 16:04:35 +0000 Subject: Fix C++11 errors and warnings with g++-7 Fixed bugs: - https://launchpad.net/bugs/1660992 (bzr r15477) --- src/uri-references.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/uri-references.cpp') diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 170c98beb..7d6abd10a 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -11,16 +11,19 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "uri-references.h" + #include #include +#include + +#include "bad-uri-exception.h" #include "document.h" #include "sp-object.h" #include "uri.h" -#include "uri-references.h" #include "extract-uri.h" #include "sp-tag-use.h" -#include namespace Inkscape { @@ -103,7 +106,7 @@ bool URIReference::_acceptObject(SPObject *obj) const -void URIReference::attach(const URI &uri) throw(BadURIException) +void URIReference::attach(const URI &uri) { SPDocument *document = NULL; -- cgit v1.2.3