diff options
| author | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-04-04 01:04:51 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-04-04 01:04:51 +0000 |
| commit | 4007abe02509fc1e312a007fb26f31c5a595df26 (patch) | |
| tree | 1baa70a370188042e52065ccc18723d1404d5de0 /src | |
| parent | Update to trunk (diff) | |
| download | inkscape-4007abe02509fc1e312a007fb26f31c5a595df26.tar.gz inkscape-4007abe02509fc1e312a007fb26f31c5a595df26.zip | |
Begin first stage of resolving issue with duplicate knots
(bzr r13090.1.46)
Diffstat (limited to 'src')
| -rw-r--r-- | src/knotholder.cpp | 14 | ||||
| -rw-r--r-- | src/live_effects/lpe-taperstroke.cpp | 10 | ||||
| -rw-r--r-- | src/live_effects/pathoutlineprovider.cpp | 4 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 5 |
4 files changed, 26 insertions, 7 deletions
diff --git a/src/knotholder.cpp b/src/knotholder.cpp index cf87423d4..94a041385 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -203,14 +203,16 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/, guint) /* do cleanup tasks (e.g., for LPE items write the parameter values * that were changed by dragging the handle to SVG) */ - if (SP_IS_LPE_ITEM(object)) { + if (dynamic_cast<SPLPEItem*> (object)) { // This writes all parameters to SVG. Is this sufficiently efficient or should we only // write the ones that were changed? - - Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(object)->getCurrentLPE(); - if (lpe) { - LivePathEffectObject *lpeobj = lpe->getLPEObj(); - lpeobj->updateRepr(); + SPLPEItem * lpeitem = SP_LPE_ITEM(this->item); + if (lpeitem) { + Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE(); + if (lpe) { + LivePathEffectObject *lpeobj = lpe->getLPEObj(); + lpeobj->updateRepr(); + } } } diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index c452c825c..dc70782c4 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -657,6 +657,11 @@ void KnotHolderEntityAttachBegin::knot_set(Geom::Point const &p, Geom::Point con Geom::Point const s = snap_knot_position(p, state); SPCurve *curve = SP_PATH(item)->get_curve_for_edit(); + if (!curve) { + //oops + lpe->attach_start.param_set_value(0); + return; + } Geom::PathVector pathv = curve->get_pathvector(); Piecewise<D2<SBasis> > pwd2; Geom::Path p_in = return_at_first_cusp(pathv[0]); @@ -678,6 +683,11 @@ void KnotHolderEntityAttachEnd::knot_set(Geom::Point const &p, Geom::Point const Geom::Point const s = snap_knot_position(p, state); SPCurve *curve = SP_PATH(item)->get_curve_for_edit(); + if (!curve) { + //oops + lpe->attach_end.param_set_value(0); + return; + } Geom::PathVector pathv = curve->get_pathvector(); Piecewise<D2<SBasis> > pwd2; Geom::Path p_in = return_at_first_cusp(pathv[0].reverse()); diff --git a/src/live_effects/pathoutlineprovider.cpp b/src/live_effects/pathoutlineprovider.cpp index 56f741417..a696728d6 100644 --- a/src/live_effects/pathoutlineprovider.cpp +++ b/src/live_effects/pathoutlineprovider.cpp @@ -1,3 +1,5 @@ +#include <glib.h> //g_critical
+
#include "pathoutlineprovider.h"
#include "livarot/path-description.h"
#include <2geom/angle.h>
@@ -262,7 +264,7 @@ void extrapolate_curves(Geom::Path& path_builder, Geom::Curve* cbc1, Geom::Curve delete arc1;
arc1 = NULL;
}
- } catch (std::exception ex) {
+ } catch (std::exception & ex) {
printf("Exception occured, probably NaN or infinite valued points: %s\n", ex.what());
path_builder.appendNew<Geom::LineSegment>(endPt);
}
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 71aa9545a..eda34a0b5 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -553,6 +553,7 @@ bool SPLPEItem::hasBrokenPathEffect() const bool SPLPEItem::hasPathEffect() const { + if (!path_effect_list) return false; //nullptr sucks if (path_effect_list->empty()) { return false; } @@ -698,6 +699,7 @@ PathEffectList const SPLPEItem::getEffectList() const Inkscape::LivePathEffect::LPEObjectReference* SPLPEItem::getCurrentLPEReference() { + if (!this->hasPathEffect()) return NULL; if (!this->current_path_effect && !this->path_effect_list->empty()) { setCurrentPathEffect(this->path_effect_list->back()); } @@ -707,6 +709,9 @@ Inkscape::LivePathEffect::LPEObjectReference* SPLPEItem::getCurrentLPEReference( Inkscape::LivePathEffect::Effect* SPLPEItem::getCurrentLPE() { + if (path_effect_list == NULL) { + return NULL; + } Inkscape::LivePathEffect::LPEObjectReference* lperef = getCurrentLPEReference(); if (lperef && lperef->lpeobject) |
