b33bf2eafe
There were two problems in the triangulation caching of SHAPE_POLY_SET: First there was a double free: While SHAPE_POLY_SET implements the copy constructor, it did not implement the operator=, which resulted in the default operator= being generated by the compiler. The default operator= copied the member m_triangulatedPolys, which is a std::vector of pointers. So after operator= execution, there are two SHAPE_POLY_SET having pointers to the same TRIANGULATED_POLYGONs, each of them deleting them in their destructors. This led to segfaults, because calling TransformShapeWithClearanceToPolygon on a Zone uses operator= to copy the contained SHAPE_POLY_SET. The new SHAPE_POLY_SET then went out of scope and deleted the cached triangulation within the Zone. This first problem is fixed by implementing operator= for SHAPE_POLY_SET. Second, there was a memory leak: Calling "CacheTriangulation" on a SHAPE_POLY_SET, then changing the polygon and then calling "CacheTriangulation" again led to leaking the triangulations generated in the first call. This second problem is fixed by holding the cached triangulations in a unique_ptr. |
||
---|---|---|
.. | ||
convex_hull.h | ||
direction45.h | ||
poly_grid_partition.h | ||
rtree.h | ||
seg.h | ||
shape.h | ||
shape_circle.h | ||
shape_convex.h | ||
shape_file_io.h | ||
shape_index.h | ||
shape_index_list.h | ||
shape_line_chain.h | ||
shape_poly_set.h | ||
shape_rect.h | ||
shape_segment.h |