kicad/include/geometry
Andreas Buhr b33bf2eafe fix double free and memory leak in SHAPE_POLY_SET
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.
2017-12-08 14:55:46 +01:00
..
convex_hull.h Pcbnew: Add rounded rect pad shape. 2016-04-06 20:15:49 +02:00
direction45.h Move DIRECTION45 to common/geometry 2017-03-22 15:23:09 +01:00
poly_grid_partition.h Fix a few minor coverity warnings (not initialized members) 2017-11-11 07:25:00 +01:00
rtree.h Remove some extra semicolons 2017-11-09 19:52:18 +01:00
seg.h pcbnew: Optimized zone filling algorithm. 2017-12-05 14:54:57 +01:00
shape.h common/geometry: introducing set-of-polygons class (SHAPE_POLY_SET) and File I/O for shapes class (SHAPE_FILE_IO) 2015-06-12 17:12:02 +02:00
shape_circle.h Add more "override" markers. 2016-09-25 13:59:41 -04:00
shape_convex.h Add more "override" markers. 2016-09-25 13:59:41 -04:00
shape_file_io.h SHAPE_FILE_IO: default constructor outputs to stdout 2017-12-05 14:54:57 +01:00
shape_index.h FIxed a few clang warnings. 2015-03-09 11:06:54 +01:00
shape_index_list.h refactoring: wrapped boost::optional in OPT<> class for the purpose of easier transition to C++17 in the future 2017-11-03 23:59:02 +01:00
shape_line_chain.h refactoring: wrapped boost::optional in OPT<> class for the purpose of easier transition to C++17 in the future 2017-11-03 23:59:02 +01:00
shape_poly_set.h fix double free and memory leak in SHAPE_POLY_SET 2017-12-08 14:55:46 +01:00
shape_rect.h Add more "override" markers. 2016-09-25 13:59:41 -04:00
shape_segment.h Add more "override" markers. 2016-09-25 13:59:41 -04:00