mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Fixed a crash on deleting objects due to the ObjectList accessing
released data before the selection was updated on the GLScene.
This commit is contained in:
		
							parent
							
								
									8140d043c8
								
							
						
					
					
						commit
						d54e14a41d
					
				
					 2 changed files with 8 additions and 9 deletions
				
			
		|  | @ -1521,7 +1521,8 @@ stl_stats ModelObject::get_object_stl_stats() const | |||
|     if (this->volumes.size() == 1) | ||||
|         return this->volumes[0]->mesh.stl.stats; | ||||
| 
 | ||||
|     stl_stats full_stats = this->volumes[0]->mesh.stl.stats; | ||||
|     stl_stats full_stats; | ||||
|     memset(&full_stats, 0, sizeof(stl_stats)); | ||||
| 
 | ||||
|     // fill full_stats from all objet's meshes
 | ||||
|     for (ModelVolume* volume : this->volumes) | ||||
|  |  | |||
|  | @ -2057,10 +2057,9 @@ void Plater::priv::remove(size_t obj_idx) | |||
|         view3D->enable_layers_editing(false); | ||||
| 
 | ||||
|     model.delete_object(obj_idx); | ||||
|     // Delete object from Sidebar list
 | ||||
|     sidebar->obj_list()->delete_object_from_list(obj_idx); | ||||
| 
 | ||||
|     update(); | ||||
|     // Delete object from Sidebar list. Do it after update, so that the GLScene selection is updated with the modified model.
 | ||||
|     sidebar->obj_list()->delete_object_from_list(obj_idx); | ||||
|     object_list_changed(); | ||||
| } | ||||
| 
 | ||||
|  | @ -2085,10 +2084,9 @@ void Plater::priv::reset() | |||
|     // Stop and reset the Print content.
 | ||||
|     this->background_process.reset(); | ||||
|     model.clear_objects(); | ||||
| 
 | ||||
|     // Delete all objects from list on c++ side
 | ||||
|     sidebar->obj_list()->delete_all_objects_from_list(); | ||||
|     update(); | ||||
|     // Delete object from Sidebar list. Do it after update, so that the GLScene selection is updated with the modified model.
 | ||||
|     sidebar->obj_list()->delete_all_objects_from_list(); | ||||
|     object_list_changed(); | ||||
| 
 | ||||
|     // The hiding of the slicing results, if shown, is not taken care by the background process, so we do it here
 | ||||
|  | @ -3392,14 +3390,14 @@ void Plater::decrease_instances(size_t num) | |||
|     if (model_object->instances.size() > num) { | ||||
|         for (size_t i = 0; i < num; ++ i) | ||||
|             model_object->delete_last_instance(); | ||||
|         p->update(); | ||||
|         // Delete object from Sidebar list. Do it after update, so that the GLScene selection is updated with the modified model.
 | ||||
|         sidebar().obj_list()->decrease_object_instances(obj_idx, num); | ||||
|     } | ||||
|     else { | ||||
|         remove(obj_idx); | ||||
|     } | ||||
| 
 | ||||
|     p->update(); | ||||
| 
 | ||||
|     if (!model_object->instances.empty()) | ||||
|         p->get_selection().add_instance(obj_idx, (int)model_object->instances.size() - 1); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv