-
Notifications
You must be signed in to change notification settings - Fork 485
Description
Description
In C++, when running the Poisson Filter for a second time, the program crashes. The reason this happens is because the Octree used by PoissonRecon is deleted accidentally the second time.
When PoissonRecon is constructed for the first time, the global flag UseAlloc is 0, meaning that the initial nodes are created on the heap, then in execute(), OctNode::SetAllocator is called, deleting all previously allocated nodes.
When PoissonRecon is constructed the second time, the global flag UseAlloc is 1, meaning the initial nodes are created with the Node Allocator! Afterwards, when execute() is called again, where OctNode::SetAllocator is called, the tree nodes are deleted as well, causing a crash later on during execution.
A simple fix, was to move the line OctNode::SetAllocator(MEMORY_ALLOCATOR_BLOCK_SIZE) to the Poisson Filter, right before the PoissonRecon is constructed (line ~300). This ensures all nodes are always created with the Node Allocator (instead of some of them on the heap) and reset properly. However, there might be better solutions.
Expected behavior
Poisson Filter can be run more than once