mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-04 22:31:02 +00:00
Multi-material segmentation derived the output slot from range.begin() divided by the granularity, which assumes tbb::blocked_range splits on grainsize multiples. It bisects at midpoints, so two sub-ranges of one group get the same slot and append into the same ExPolygons at once. With ten layers and a granularity of two, the sub-ranges [2,3) and [3,5) collide. The granularity is two or more whenever the shell layers are three or more, which is the default. The loop now iterates groups, so the slot follows the element index and the partitioner cannot cut a group in half. CutSurface wrote std::vector<bool> elements from a parallel_for. The bits share words across chunk boundaries, so flags were lost. name_tbb_thread_pool_threads_set_locale() held every chunk of a parallel_for on a condition variable until max_concurrency() of them were running. TBB does not promise that, and there is no timeout, so the slicing thread could wait forever. A task_scheduler_observer sets each worker up as it joins the arena, which needs no simultaneity and covers workers the chunked version never reached. TriangleSetSampling dereferenced upper_bound() without checking for end(), which is reachable because the sum is a float and the keys are doubles. TreeModelVolumes re-read getMaxCalculatedLayer() after releasing the lock, so the layer difference could go negative and become a huge size_t. The two sibling functions already carry the guard this adds.