Bugfix: random but frequent crashes after recent perimeter code refactoring

This commit is contained in:
Alessandro Ranellucci 2015-01-14 22:55:11 +01:00
parent d1243397fa
commit bf02062a67
3 changed files with 8 additions and 1 deletions

View file

@ -259,7 +259,8 @@ sub process {
|| ($self->layer_id == 0 && $self->print_config->brim_width > 0); || ($self->layer_id == 0 && $self->print_config->brim_width > 0);
# append perimeters for this slice as a collection # append perimeters for this slice as a collection
$self->loops->append(Slic3r::ExtrusionPath::Collection->new(@loops)); $self->loops->append(Slic3r::ExtrusionPath::Collection->new(@loops))
if @loops;
} }
} }

View file

@ -425,6 +425,8 @@ sub process_layer {
{ {
my $extruder_id = $region->config->perimeter_extruder-1; my $extruder_id = $region->config->perimeter_extruder-1;
foreach my $perimeter_coll (@{$layerm->perimeters}) { foreach my $perimeter_coll (@{$layerm->perimeters}) {
next if $perimeter_coll->empty; # this shouldn't happen but first_point() would fail
# init by_extruder item only if we actually use the extruder # init by_extruder item only if we actually use the extruder
$by_extruder{$extruder_id} //= []; $by_extruder{$extruder_id} //= [];
@ -447,6 +449,8 @@ sub process_layer {
# throughout the code). We can redefine the order of such Collections but we have to # throughout the code). We can redefine the order of such Collections but we have to
# do each one completely at once. # do each one completely at once.
foreach my $fill (@{$layerm->fills}) { foreach my $fill (@{$layerm->fills}) {
next if $fill->empty; # this shouldn't happen but first_point() would fail
# init by_extruder item only if we actually use the extruder # init by_extruder item only if we actually use the extruder
my $extruder_id = $fill->[0]->is_solid_infill my $extruder_id = $fill->[0]->is_solid_infill
? $region->config->solid_infill_extruder-1 ? $region->config->solid_infill_extruder-1

View file

@ -24,6 +24,8 @@
Clone<Point> last_point(); Clone<Point> last_point();
int count() int count()
%code{% RETVAL = THIS->entities.size(); %}; %code{% RETVAL = THIS->entities.size(); %};
bool empty()
%code{% RETVAL = THIS->entities.empty(); %};
std::vector<size_t> orig_indices() std::vector<size_t> orig_indices()
%code{% RETVAL = THIS->orig_indices; %}; %code{% RETVAL = THIS->orig_indices; %};
%{ %{