kewur / poly2tri

Automatically exported from code.google.com/p/poly2tri
Other
0 stars 0 forks source link

SweepContext ctor leaves several member variables uninitialized which can cause crash #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Instantiate a CDT object 
2. Delete it without calling CDT::Triangulate
3. SweepContext dtor tries to delete six uninitialized pointers

What version of the product are you using? On what operating system?

Windows 7 x64 with VS2010 C++

Not sure how to get the version number, but I just created a clone of the 
project a few days ago.

I suggest updating SweepContext ctor like this to initialize the six pointers 
which are uninitialized before Triangulate:

SweepContext::SweepContext(std::vector<Point*> polyline) :
  front_(0),
  head_(0),
  tail_(0),
  af_head_(0),
  af_middle_(0),
  af_tail_(0)
{
  basin = Basin();
  edge_event = EdgeEvent();

  points_ = polyline;

  InitEdges(points_);
}

Original issue reported on code.google.com by cgod...@gmail.com on 30 Apr 2013 at 6:35

GoogleCodeExporter commented 9 years ago
thanks; will check this out.

Original comment by mason.gr...@gmail.com on 2 May 2013 at 1:25

GoogleCodeExporter commented 9 years ago
changed. thanks!

Original comment by mason.gr...@gmail.com on 2 May 2013 at 1:47