diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 4474550f58..9e61630fb2 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1434,10 +1434,10 @@ sub reload_from_disk { return if !$model_object->input_file || !-e $model_object->input_file; - my @obj_idx = $self->load_file($model_object->input_file); - return if !@obj_idx; + my @new_obj_idx = $self->load_file($model_object->input_file); + return if !@new_obj_idx; - foreach my $new_obj_idx (@obj_idx) { + foreach my $new_obj_idx (@new_obj_idx) { my $o = $self->{model}->objects->[$new_obj_idx]; $o->clear_instances; $o->add_instance($_) for @{$model_object->instances}; @@ -1450,6 +1450,12 @@ sub reload_from_disk { } $self->remove($obj_idx); + + # Trigger thumbnail generation again, because the remove() method altered + # object indexes before background thumbnail generation called its completion + # event, so the on_thumbnail_made callback is called with the wrong $obj_idx. + # When porting to C++ we'll probably have cleaner ways to do this. + $self->make_thumbnail($_-1) for @new_obj_idx; } sub export_object_stl {