mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
FIX: tree supports may generate flying nodes
Previous parallelization has a bug where two adjacent nodes may be deleted at the same time. jira: none Change-Id: I99a29dae9f72aa74ed2721eea4421b15eec10732 (cherry picked from commit 91efe67d723652d3f7e4484dd3cdf31638f769a4) (cherry picked from commit 734a70b493b0347870dc955021b0f7055c76f84b)
This commit is contained in:
parent
2577b9b3a6
commit
5a8612eb63
1 changed files with 10 additions and 5 deletions
|
@ -2547,7 +2547,7 @@ void TreeSupport::drop_nodes(std::vector<std::vector<SupportNode*>>& contact_nod
|
|||
// Remove all circle neighbours that are completely inside the polygon and merge them into this node.
|
||||
for (const Point &neighbour : neighbours) {
|
||||
SupportNode * neighbour_node = nodes_this_part[neighbour];
|
||||
if(neighbour_node->type==ePolygon) return;
|
||||
if(neighbour_node->type==ePolygon) continue;
|
||||
coord_t neighbour_radius = scale_(neighbour_node->radius);
|
||||
Point pt_north = neighbour + Point(0, neighbour_radius), pt_south = neighbour - Point(0, neighbour_radius),
|
||||
pt_west = neighbour - Point(neighbour_radius, 0), pt_east = neighbour + Point(neighbour_radius, 0);
|
||||
|
@ -2606,10 +2606,15 @@ void TreeSupport::drop_nodes(std::vector<std::vector<SupportNode*>>& contact_nod
|
|||
// only allow bigger node to merge smaller nodes. See STUDIO-6326
|
||||
if(node.dist_mm_to_top < neighbour_node->dist_mm_to_top) continue;
|
||||
|
||||
node.merged_neighbours.push_front(neighbour_node);
|
||||
node.merged_neighbours.insert(node.merged_neighbours.end(), neighbour_node->merged_neighbours.begin(), neighbour_node->merged_neighbours.end());
|
||||
to_delete.insert(neighbour_node);
|
||||
neighbour_node->valid = false;
|
||||
m_ts_data->m_mutex.lock();
|
||||
if (to_delete.find(p_node) == to_delete.end())
|
||||
{ // since we are processing all nodes in parallel, p_node may have been deleted by another thread. In this case, we should not delete neighbour_node.
|
||||
node.merged_neighbours.push_front(neighbour_node);
|
||||
node.merged_neighbours.insert(node.merged_neighbours.end(), neighbour_node->merged_neighbours.begin(), neighbour_node->merged_neighbours.end());
|
||||
to_delete.insert(neighbour_node);
|
||||
neighbour_node->valid = false;
|
||||
}
|
||||
m_ts_data->m_mutex.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue