From 1fb2a9dbb00fbf4c2ff3a34502cdd552730e78d7 Mon Sep 17 00:00:00 2001 From: ChristiaanSmith <11035832+ChristiaanSmith@users.noreply.github.com> Date: Thu, 23 Sep 2021 15:53:54 +0100 Subject: [PATCH] Fix adding a path effect to symbol causes crash Fixes https://gitlab.com/inkscape/inkscape/-/issues/2522 --- src/ui/dialog/livepatheffect-editor.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 835ae0839c..3d13150acd 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -35,6 +35,7 @@ #include "object/sp-item-group.h" #include "object/sp-path.h" #include "object/sp-use.h" +#include "object/sp-symbol.h" #include "object/sp-text.h" #include "ui/icon-names.h" @@ -306,14 +307,17 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) } } else { SPUse *use = dynamic_cast(item); - if ( use ) { + if (use) { // test whether linked object is supported by the CLONE_ORIGINAL LPE + SPItem *root = use->root(); SPItem *orig = use->get_original(); - if ( dynamic_cast(orig) || - dynamic_cast(orig) || - dynamic_cast(orig) ) - { - // Note that an SP_USE cannot have an LPE applied, so we only need to worry about the "add effect" case. + if (dynamic_cast(root)) { + showText(_("Path effect cannot be applied to symbols")); + set_sensitize_all(false); + } else if (dynamic_cast(orig) || dynamic_cast(orig) || + dynamic_cast(orig)) { + // Note that an SP_USE cannot have an LPE applied, so we only need to worry about the "add + // effect" case. set_sensitize_all(true); showText(_("Click add button to convert clone")); button_remove.set_sensitive(false); -- GitLab