summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosh Andler <scislac@gmail.com>2010-01-12 02:27:16 +0000
committerJosh Andler <scislac@gmail.com>2010-01-12 02:27:16 +0000
commit19221d9ad4c6aecb5f532822ad64ff63859d6531 (patch)
tree210e9e999ca57a12a28c748388413c7229075db1 /src
parentImplemented dynamic repositioning of toolboxes. (diff)
downloadinkscape-19221d9ad4c6aecb5f532822ad64ff63859d6531.tar.gz
inkscape-19221d9ad4c6aecb5f532822ad64ff63859d6531.zip
Adapt recent recursive reference patch for masks to protect from crashing on clippaths too
(bzr r8969)
Diffstat (limited to 'src')
-rw-r--r--src/sp-clippath.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/sp-clippath.h b/src/sp-clippath.h
index 199b29f3b..02395f3d2 100644
--- a/src/sp-clippath.h
+++ b/src/sp-clippath.h
@@ -22,9 +22,10 @@
class SPClipPathView;
#include "display/nr-arena-forward.h"
+#include "libnr/nr-forward.h"
#include "sp-object-group.h"
#include "uri-references.h"
-#include <libnr/nr-forward.h>
+#include "xml/node.h"
struct SPClipPath : public SPObjectGroup {
class Reference;
@@ -48,8 +49,39 @@ public:
return (SPClipPath *)URIReference::getObject();
}
protected:
+ /**
+ * If the owner element of this reference (the element with <... clippath="...">)
+ * is a child of the clippath it refers to, return false.
+ * \return false if obj is not a clippath or if obj is a parent of this
+ * reference's owner element. True otherwise.
+ */
virtual bool _acceptObject(SPObject *obj) const {
- return SP_IS_CLIPPATH(obj);
+ if (!SP_IS_CLIPPATH(obj)) {
+ return false;
+ }
+ SPObject * const owner = this->getOwner();
+ if (obj->isAncestorOf(owner)) {
+ Inkscape::XML::Node * const owner_repr = owner->repr;
+ Inkscape::XML::Node * const obj_repr = obj->repr;
+ gchar const * owner_name = NULL;
+ gchar const * owner_clippath = NULL;
+ gchar const * obj_name = NULL;
+ gchar const * obj_id = NULL;
+ if (owner_repr != NULL) {
+ owner_name = owner_repr->name();
+ owner_clippath = owner_repr->attribute("clippath");
+ }
+ if (obj_repr != NULL) {
+ obj_name = obj_repr->name();
+ obj_id = obj_repr->attribute("id");
+ }
+ g_warning("Ignoring recursive clippath reference "
+ "<%s clippath=\"%s\"> in <%s id=\"%s\">",
+ owner_name, owner_clippath,
+ obj_name, obj_id);
+ return false;
+ }
+ return true;
}
};