From 403bb926c8d2cecbb26eae4ec5678a6e964c43cb Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Fri, 11 Jun 2021 17:29:16 +0200 Subject: [PATCH] Fixed regression bug after PrintRegions refactoring: Fixed crash if an object is outside the print bed, its modifier inside the print bed and the modifier gets deleted. --- src/libslic3r/PrintApply.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/PrintApply.cpp b/src/libslic3r/PrintApply.cpp index fe3e689630..698edbf3b6 100644 --- a/src/libslic3r/PrintApply.cpp +++ b/src/libslic3r/PrintApply.cpp @@ -1080,7 +1080,8 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_ if (solid_or_modifier_differ || model_origin_translation_differ || layer_height_ranges_differ || ! model_object.layer_height_profile.timestamp_matches(model_object_new.layer_height_profile)) { // The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects. - model_object_status.print_object_regions_status = model_origin_translation_differ || layer_height_ranges_differ ? + model_object_status.print_object_regions_status = + model_object_status.print_object_regions == nullptr || model_origin_translation_differ || layer_height_ranges_differ ? // Drop print_objects_regions. ModelObjectStatus::PrintObjectRegionsStatus::Invalid : // Reuse bounding boxes of print_objects_regions for ModelVolumes with unmodified transformation. @@ -1092,7 +1093,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_ if (model_object_status.print_object_regions_status == ModelObjectStatus::PrintObjectRegionsStatus::PartiallyValid) // Drop everything from PrintObjectRegions but those VolumeExtents (of their particular ModelVolumes) that are still valid. print_objects_regions_invalidate_keep_some_volumes(*model_object_status.print_object_regions, model_object.volumes, model_object_new.volumes); - else + else if (model_object_status.print_object_regions != nullptr) model_object_status.print_object_regions->clear(); // Copy content of the ModelObject including its ID, do not change the parent. model_object.assign_copy(model_object_new);