mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	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
					
				
					 3 changed files with 6 additions and 10 deletions
				
			
		|  | @ -463,7 +463,7 @@ Print::apply_config(DynamicPrintConfig config) | |||
|              | ||||
|             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) { | ||||
|                 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); | ||||
|                  | ||||
|  |  | |||
|  | @ -76,8 +76,10 @@ class PrintObject | |||
|     friend class Print; | ||||
| 
 | ||||
|     public: | ||||
|     // vector of (vectors of volume ids), indexed by region_id
 | ||||
|     std::vector<std::vector<int> > region_volumes; | ||||
|     // map of (vectors of volume ids), indexed by region_id
 | ||||
|     /* (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; | ||||
|     t_layer_height_ranges layer_height_ranges; | ||||
|      | ||||
|  |  | |||
|  | @ -10,8 +10,6 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Bounding | |||
|     _model_object(model_object), | ||||
|     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
 | ||||
|     { | ||||
|         // Translate meshes so that our toolpath generation algorithms work with smaller
 | ||||
|  | @ -125,10 +123,6 @@ PrintObject::bounding_box(BoundingBox* bb) const | |||
| void | ||||
| 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); | ||||
| } | ||||
| 
 | ||||
|  | @ -369,7 +363,7 @@ PrintObject::bridge_over_infill() | |||
|             diff(internal_solid, to_bridge, ¬_to_bridge, true); | ||||
|              | ||||
|             #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 | ||||
|              | ||||
|             // build the new collection of fill_surfaces
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci