summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-01-26 19:05:22 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-01-26 19:05:22 +0000
commitebc97812252f2cbf98f9127f0c9173d0ace911d8 (patch)
tree9d71da24604c114c3286fa9a942b87e0004f7160 /src/selection-chemistry.cpp
parentremove obsolete assert (diff)
downloadinkscape-ebc97812252f2cbf98f9127f0c9173d0ace911d8.tar.gz
inkscape-ebc97812252f2cbf98f9127f0c9173d0ace911d8.zip
temporary fix: prevent crash when clipping/masking an object with its own clone
(bzr r2290)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index fbf5d52df..feddc9e29 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2581,6 +2581,30 @@ sp_selection_set_mask(bool apply_clip_path, bool apply_to_layer)
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select mask object and <b>object(s)</b> to apply clippath or mask to."));
return;
}
+
+ // FIXME: temporary patch to prevent crash!
+ // Remove this when bboxes are fixed to not blow up on an item clipped/masked with its own clone
+ bool clone_with_original = false;
+ for (GSList const *l = selection->itemList(); l != NULL; l = l->next) {
+ SPItem *item = SP_ITEM(l->data);
+ bool is_use = SP_IS_USE(item);
+ SPItem *item_use = item;
+ SPItem *item_use_first = item;
+ while (is_use && item_use && !clone_with_original)
+ {
+ item_use = sp_use_get_original (SP_USE(item_use));
+ clone_with_original |= selection->includes(item_use);
+ if (item_use == item_use_first)
+ break;
+ is_use = SP_IS_USE(item_use);
+ }
+ if (clone_with_original)
+ break;
+ }
+ if (clone_with_original) {
+ return; // in this version, you cannot clip/mask an object with its own clone
+ }
+ // /END FIXME
sp_document_ensure_up_to_date(document);