mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	FIX: empty layer replacement may crash
When there are multiple empty layers needs to be replaced, error_msg is assigned multiple times simutaneously by tbb, which causes problem. Jira: STUDIO-3320 Change-Id: I52a48c9fe284d15aeb8e4e9e5d1db7e0c3321ad6 (cherry picked from commit fba54c063637a1bab4d835e2e5f8558b2affa4e6)
This commit is contained in:
		
							parent
							
								
									bc2357e9a3
								
							
						
					
					
						commit
						501e73913c
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -675,9 +675,10 @@ std::string fix_slicing_errors(PrintObject* object, LayerPtrs &layers, const std
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    BOOST_LOG_TRIVIAL(debug) << "Slicing objects - fixing slicing errors in parallel - begin";
 | 
			
		||||
    std::atomic<bool> is_replaced = false;
 | 
			
		||||
    tbb::parallel_for(
 | 
			
		||||
        tbb::blocked_range<size_t>(0, buggy_layers.size()),
 | 
			
		||||
        [&layers, &throw_if_canceled, &buggy_layers, &error_msg](const tbb::blocked_range<size_t>& range) {
 | 
			
		||||
        [&layers, &throw_if_canceled, &buggy_layers, &is_replaced](const tbb::blocked_range<size_t>& range) {
 | 
			
		||||
            for (size_t buggy_layer_idx = range.begin(); buggy_layer_idx < range.end(); ++ buggy_layer_idx) {
 | 
			
		||||
                throw_if_canceled();
 | 
			
		||||
                size_t idx_layer = buggy_layers[buggy_layer_idx];
 | 
			
		||||
| 
						 | 
				
			
			@ -724,7 +725,7 @@ std::string fix_slicing_errors(PrintObject* object, LayerPtrs &layers, const std
 | 
			
		|||
                        }
 | 
			
		||||
                    if (!expolys.empty()) {
 | 
			
		||||
                        //BBS
 | 
			
		||||
                        error_msg = L("Empty layers around bottom are replaced by nearest normal layers.");
 | 
			
		||||
                        is_replaced = true;
 | 
			
		||||
                        layerm->slices.set(union_ex(expolys), stInternal);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			@ -735,6 +736,9 @@ std::string fix_slicing_errors(PrintObject* object, LayerPtrs &layers, const std
 | 
			
		|||
    throw_if_canceled();
 | 
			
		||||
    BOOST_LOG_TRIVIAL(debug) << "Slicing objects - fixing slicing errors in parallel - end";
 | 
			
		||||
 | 
			
		||||
    if(is_replaced)
 | 
			
		||||
        error_msg = L("Empty layers around bottom are replaced by nearest normal layers.");
 | 
			
		||||
 | 
			
		||||
    // remove empty layers from bottom
 | 
			
		||||
    while (! layers.empty() && (layers.front()->lslices.empty() || layers.front()->empty())) {
 | 
			
		||||
        delete layers.front();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue