Reduced memory leaks in ConfigDef / PrintConfigDef

Deleted unsafe default copy constructors / operators in Model / ModelObject / ModelInstance / ModelVolume
Fixed some issues with copying the Model / ModelObject / ModelInstance / ModelVolume inside Print::apply()
Fixed some invalidation issues in Print::apply()
Temporarily renamed the Slic3rPE profile directory to Slic3rPE-alpha.
This commit is contained in:
bubnikv 2018-10-30 15:24:36 +01:00
parent 63960dfde0
commit 66e97aa4eb
7 changed files with 67 additions and 34 deletions

View file

@ -889,8 +889,7 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
const_cast<PrintObjectStatus&>(*it).status = PrintObjectStatus::Deleted;
}
// Copy content of the ModelObject including its ID, reset the parent.
model_object = model_object_new;
model_object.set_model(&m_model);
model_object.assign(&model_object_new);
} else if (support_blockers_differ || support_enforcers_differ) {
// First stop background processing before shuffling or deleting the ModelVolumes in the ModelObject's list.
m_cancel_callback();
@ -982,8 +981,10 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
// The PrintObject already exists and the copies differ.
if ((*it_old)->print_object->copies().size() != new_instances.copies.size())
update_apply_status(this->invalidate_step(psWipeTower));
update_apply_status(this->invalidate_step(psSkirt) || this->invalidate_step(psBrim) || this->invalidate_step(psGCodeExport));
(*it_old)->print_object->set_copies(new_instances.copies);
if ((*it_old)->print_object->set_copies(new_instances.copies)) {
// Invalidated
update_apply_status(this->invalidate_step(psSkirt) || this->invalidate_step(psBrim) || this->invalidate_step(psGCodeExport));
}
print_objects_new.emplace_back((*it_old)->print_object);
const_cast<PrintObjectStatus*>(*it_old)->status = PrintObjectStatus::Reused;
}
@ -1109,7 +1110,7 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
region_id = map_volume_to_region[volume_id];
// Assign volume to a region.
if (fresh) {
if (print_object.region_volumes.empty())
if (region_id >= print_object.region_volumes.size() || print_object.region_volumes[region_id].empty())
++ m_regions[region_id]->m_refcnt;
print_object.add_region_volume(region_id, volume_id);
}