Bugfix: the region_volumes vector was not always extended after creating new regions, causing bad memory access in apply_config(). #2446
This commit is contained in:
parent
33f7b08c80
commit
5639132dae
@ -463,7 +463,7 @@ Print::apply_config(DynamicPrintConfig config)
|
|||||||
|
|
||||||
std::vector<int> ®ion_volumes = object->region_volumes[region_id];
|
std::vector<int> ®ion_volumes = object->region_volumes[region_id];
|
||||||
for (std::vector<int>::const_iterator volume_id = region_volumes.begin(); volume_id != region_volumes.end(); ++volume_id) {
|
for (std::vector<int>::const_iterator volume_id = region_volumes.begin(); volume_id != region_volumes.end(); ++volume_id) {
|
||||||
ModelVolume* volume = object->model_object()->volumes[*volume_id];
|
ModelVolume* volume = object->model_object()->volumes.at(*volume_id);
|
||||||
|
|
||||||
PrintRegionConfig new_config = this->_region_config_from_model_volume(*volume);
|
PrintRegionConfig new_config = this->_region_config_from_model_volume(*volume);
|
||||||
|
|
||||||
|
@ -76,8 +76,10 @@ class PrintObject
|
|||||||
friend class Print;
|
friend class Print;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// vector of (vectors of volume ids), indexed by region_id
|
// map of (vectors of volume ids), indexed by region_id
|
||||||
std::vector<std::vector<int> > region_volumes;
|
/* (we use map instead of vector so that we don't have to worry about
|
||||||
|
resizing it and the [] operator adds new items automagically) */
|
||||||
|
std::map< size_t,std::vector<int> > region_volumes;
|
||||||
PrintObjectConfig config;
|
PrintObjectConfig config;
|
||||||
t_layer_height_ranges layer_height_ranges;
|
t_layer_height_ranges layer_height_ranges;
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Bounding
|
|||||||
_model_object(model_object),
|
_model_object(model_object),
|
||||||
typed_slices(false)
|
typed_slices(false)
|
||||||
{
|
{
|
||||||
region_volumes.resize(this->_print->regions.size());
|
|
||||||
|
|
||||||
// Compute the translation to be applied to our meshes so that we work with smaller coordinates
|
// Compute the translation to be applied to our meshes so that we work with smaller coordinates
|
||||||
{
|
{
|
||||||
// Translate meshes so that our toolpath generation algorithms work with smaller
|
// Translate meshes so that our toolpath generation algorithms work with smaller
|
||||||
@ -125,10 +123,6 @@ PrintObject::bounding_box(BoundingBox* bb) const
|
|||||||
void
|
void
|
||||||
PrintObject::add_region_volume(int region_id, int volume_id)
|
PrintObject::add_region_volume(int region_id, int volume_id)
|
||||||
{
|
{
|
||||||
if (region_id >= region_volumes.size()) {
|
|
||||||
region_volumes.resize(region_id + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
region_volumes[region_id].push_back(volume_id);
|
region_volumes[region_id].push_back(volume_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +363,7 @@ PrintObject::bridge_over_infill()
|
|||||||
diff(internal_solid, to_bridge, ¬_to_bridge, true);
|
diff(internal_solid, to_bridge, ¬_to_bridge, true);
|
||||||
|
|
||||||
#ifdef SLIC3R_DEBUG
|
#ifdef SLIC3R_DEBUG
|
||||||
printf "Bridging %d internal areas at layer %d\n", scalar(@$to_bridge), $layer_id;
|
printf("Bridging %zu internal areas at layer %d\n", to_bridge.size(), layer->id());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// build the new collection of fill_surfaces
|
// build the new collection of fill_surfaces
|
||||||
|
Loading…
Reference in New Issue
Block a user