diff options
| author | Michael G. Sloan <mgsloan@gmail.com> | 2007-08-18 02:17:00 +0000 |
|---|---|---|
| committer | mgsloan <mgsloan@users.sourceforge.net> | 2007-08-18 02:17:00 +0000 |
| commit | 9abe06fbb7b13c9f5162159f54cb0fef08fce34e (patch) | |
| tree | 0850bce022b63a7b7a9be50eae1d3b10b517dd86 /src/2geom | |
| parent | few changes in import from ocal dialog (diff) | |
| download | inkscape-9abe06fbb7b13c9f5162159f54cb0fef08fce34e.tar.gz inkscape-9abe06fbb7b13c9f5162159f54cb0fef08fce34e.zip | |
Fixing a possible segfault in the sbasis to path code (also committed to 2geom))
(bzr r3503)
Diffstat (limited to 'src/2geom')
| -rw-r--r-- | src/2geom/sbasis-to-bezier.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/2geom/sbasis-to-bezier.cpp b/src/2geom/sbasis-to-bezier.cpp index 731680075..e823b29ca 100644 --- a/src/2geom/sbasis-to-bezier.cpp +++ b/src/2geom/sbasis-to-bezier.cpp @@ -172,17 +172,19 @@ void build_from_sbasis(Geom::PathBuilder &pb, D2<SBasis> const &B, double tol) { } } -void -path_from_sbasis(Geom::Path &p, D2<SBasis> const &B, double tol) { +Path +path_from_sbasis(D2<SBasis> const &B, double tol) { PathBuilder pb; pb.moveTo(B.at0()); build_from_sbasis(pb, B, tol); - p = pb.peek().front(); + pb.finish(); + return pb.peek().front(); } //TODO: some of this logic should be lifted into svg-path std::vector<Geom::Path> path_from_piecewise(Geom::Piecewise<Geom::D2<Geom::SBasis> > const &B, double tol) { + Geom::PathBuilder pb; if(B.size() == 0) return pb.peek(); Geom::Point start = B[0].at0(); @@ -206,6 +208,7 @@ path_from_piecewise(Geom::Piecewise<Geom::D2<Geom::SBasis> > const &B, double to } build_from_sbasis(pb, B[i], tol); } + pb.finish(); return pb.peek(); } |
