Skip to content

Commit 495f61f

Browse files
committed
Merge pull request flann-lib#245 from saedrna/master
fix constructor and deconstructor of the KDTreeIndex::Node.
2 parents 6f1d8f8 + d1a3d52 commit 495f61f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/cpp/flann/algorithms/kdtree_index.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,19 @@ class KDTreeIndex : public NNIndex<Distance>
299299
* Point data
300300
*/
301301
ElementType* point;
302-
/**
303-
* The child nodes.
304-
*/
305-
Node* child1, * child2;
306-
307-
~Node() {
308-
if (child1!=NULL) child1->~Node();
309-
if (child2!=NULL) child2->~Node();
310-
}
302+
/**
303+
* The child nodes.
304+
*/
305+
Node* child1, *child2;
306+
Node(){
307+
child1 = NULL;
308+
child2 = NULL;
309+
}
310+
~Node() {
311+
if (child1 != NULL) { child1->~Node(); child1 = NULL; }
312+
313+
if (child2 != NULL) { child2->~Node(); child2 = NULL; }
314+
}
311315

312316
private:
313317
template<typename Archive>

0 commit comments

Comments
 (0)