# HG changeset patch # User Radek Brich # Date 1196025760 -3600 # Node ID 5176ba000a67f68bc75e319fe16e148f05c2e676 # Parent 20bceb605f48fa4e125100c37fd66b0874f467cb fix last leak as reported by valgrind diff -r 20bceb605f48 -r 5176ba000a67 Makefile --- a/Makefile Sun Nov 25 21:47:10 2007 +0100 +++ b/Makefile Sun Nov 25 22:22:40 2007 +0100 @@ -34,8 +34,8 @@ %.o: src/%.cc $(CXX) -c -o $@ src/$*.cc $(CCFLAGS) -test%: tests/%.cc - $(CXX) -o $@ tests/$*.cc $(CCFLAGS) +test%: tests/%.cc + $(CXX) -o $@ tests/$*.cc $(CCFLAGS) ./$@ diff -r 20bceb605f48 -r 5176ba000a67 src/kdtree.cc --- a/src/kdtree.cc Sun Nov 25 21:47:10 2007 +0100 +++ b/src/kdtree.cc Sun Nov 25 22:22:40 2007 +0100 @@ -90,7 +90,7 @@ KdNode::~KdNode() { if (isLeaf()) - ;//delete shapes; // this sigsegvs for unknown reason + delete shapes; else delete[] children; } @@ -237,7 +237,7 @@ float rnum = splitpos->rnum; // split this node - //delete shapes; + delete shapes; children = new KdNode[2]; int state = 0; for (sh = sslist.begin(); sh != sslist.end(); sh++) @@ -301,7 +301,9 @@ void KdTree::build() { root = new KdNode(); - root->shapes = &shapes; + ShapeList::iterator shape; + for (shape = shapes.begin(); shape != shapes.end(); shape++) + root->addShape(*shape); root->subdivide(bbox, 0); built = true; }