diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-01-01 22:08:45 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-01-01 22:08:45 +0000 |
| commit | 4c59c0717100f4c71ccef71a1f5b0521f3f7c0ad (patch) | |
| tree | b53ecdfe8785e4b05501eccc369efa783eda2e0b /src/live_effects/lpe-patternalongpath.cpp | |
| parent | Cleanup comments and unused functions (diff) | |
| download | inkscape-4c59c0717100f4c71ccef71a1f5b0521f3f7c0ad.tar.gz inkscape-4c59c0717100f4c71ccef71a1f5b0521f3f7c0ad.zip | |
Fixes crashes with knoth in bend and pattern along path
Diffstat (limited to 'src/live_effects/lpe-patternalongpath.cpp')
| -rw-r--r-- | src/live_effects/lpe-patternalongpath.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp index 33c07b2cb..efd1aec2d 100644 --- a/src/live_effects/lpe-patternalongpath.cpp +++ b/src/live_effects/lpe-patternalongpath.cpp @@ -47,6 +47,11 @@ namespace WPAP { class KnotHolderEntityWidthPatternAlongPath : public LPEKnotHolderEntity { public: KnotHolderEntityWidthPatternAlongPath(LPEPatternAlongPath * effect) : LPEKnotHolderEntity(effect) {} + virtual ~KnotHolderEntityWidthPatternAlongPath() + { + LPEPatternAlongPath *lpe = dynamic_cast<LPEPatternAlongPath *> (_effect); + lpe->_knot_entity = NULL; + } virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual Geom::Point knot_get() const; }; @@ -98,7 +103,7 @@ LPEPatternAlongPath::LPEPatternAlongPath(LivePathEffectObject *lpeobject) : registerParameter(&fuse_tolerance); prop_scale.param_set_digits(3); prop_scale.param_set_increments(0.01, 0.10); - knot_entity = NULL; + _knot_entity = NULL; _provides_knotholder_entities = true; } @@ -116,21 +121,14 @@ LPEPatternAlongPath::doBeforeEffect (SPLPEItem const* lpeitem) if (bbox) { original_height = (*bbox)[Geom::Y].max() - (*bbox)[Geom::Y].min(); } - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop) { - Inkscape::Selection * sel = SP_ACTIVE_DESKTOP->getSelection(); - SPItem * item = sel->singleItem(); - if (item->getId() == sp_lpe_item->getId() && static_cast<LPEPatternAlongPath*>(sp_lpe_item->getCurrentLPE()) == this) { - if (knot_entity && knot_entity->knot) { - if (hide_knot) { - helper_path.clear(); - knot_entity->knot->hide(); - } else { - knot_entity->knot->show(); - } - knot_entity->update_knot(); - } + if (_knot_entity) { + if (hide_knot) { + helper_path.clear(); + _knot_entity->knot->hide(); + } else { + _knot_entity->knot->show(); } + _knot_entity->update_knot(); } } @@ -296,12 +294,12 @@ LPEPatternAlongPath::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vect void LPEPatternAlongPath::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { - knot_entity = new WPAP::KnotHolderEntityWidthPatternAlongPath(this); - knot_entity->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Change the width"), SP_KNOT_SHAPE_CIRCLE); - knotholder->add(knot_entity); + _knot_entity = new WPAP::KnotHolderEntityWidthPatternAlongPath(this); + _knot_entity->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Change the width"), SP_KNOT_SHAPE_CIRCLE); + knotholder->add(_knot_entity); if (hide_knot) { - knot_entity->knot->hide(); - knot_entity->update_knot(); + _knot_entity->knot->hide(); + _knot_entity->update_knot(); } } |
