Fix segfault when calling chained_path() on an ExtrusionPathCollection using no_sort. Includes regression test
This commit is contained in:
parent
f523c095b1
commit
ac5e713323
3 changed files with 7 additions and 3 deletions
|
@ -44,7 +44,7 @@ sub fill_surface {
|
||||||
my $last_pos = Slic3r::Point->new(0,0);
|
my $last_pos = Slic3r::Point->new(0,0);
|
||||||
foreach my $loop (@loops) {
|
foreach my $loop (@loops) {
|
||||||
push @paths, $loop->split_at_index($last_pos->nearest_point_index(\@$loop));
|
push @paths, $loop->split_at_index($last_pos->nearest_point_index(\@$loop));
|
||||||
$last_pos = $paths[-1][-1];
|
$last_pos = $paths[-1]->last_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
# clip the paths to avoid the extruder to get exactly on the first point of the loop
|
# clip the paths to avoid the extruder to get exactly on the first point of the loop
|
||||||
|
|
|
@ -45,7 +45,7 @@ ExtrusionEntityCollection::chained_path(bool no_reverse) const
|
||||||
ExtrusionEntityCollection*
|
ExtrusionEntityCollection*
|
||||||
ExtrusionEntityCollection::chained_path_from(Point* start_near, bool no_reverse) const
|
ExtrusionEntityCollection::chained_path_from(Point* start_near, bool no_reverse) const
|
||||||
{
|
{
|
||||||
if (this->no_sort) return new ExtrusionEntityCollection(*this);
|
if (this->no_sort) return this->clone();
|
||||||
ExtrusionEntityCollection* retval = new ExtrusionEntityCollection;
|
ExtrusionEntityCollection* retval = new ExtrusionEntityCollection;
|
||||||
|
|
||||||
ExtrusionEntitiesPtr my_paths;
|
ExtrusionEntitiesPtr my_paths;
|
||||||
|
|
|
@ -4,7 +4,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Slic3r::XS;
|
use Slic3r::XS;
|
||||||
use Test::More tests => 13;
|
use Test::More tests => 14;
|
||||||
|
|
||||||
my $points = [
|
my $points = [
|
||||||
[100, 100],
|
[100, 100],
|
||||||
|
@ -73,6 +73,10 @@ is scalar(@{$collection->[1]}), 1, 'appended collection was duplicated';
|
||||||
[ map $_->x, map @{$_->polyline}, @{$collection->chained_path_from(Slic3r::Point->new(30,0), 0)} ],
|
[ map $_->x, map @{$_->polyline}, @{$collection->chained_path_from(Slic3r::Point->new(30,0), 0)} ],
|
||||||
[reverse 4, 10, 15, 10, 15, 20],
|
[reverse 4, 10, 15, 10, 15, 20],
|
||||||
'chained_path_from';
|
'chained_path_from';
|
||||||
|
|
||||||
|
$collection->no_sort(1);
|
||||||
|
my @foo = @{$collection->chained_path(0)};
|
||||||
|
pass 'chained_path with no_sort';
|
||||||
}
|
}
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
|
Loading…
Reference in a new issue