mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 05:37:21 -05:00
The bounding box tree is destroyed by deleteInternalNodesBottomUp, which recursed once per tree level. For deep or unbalanced trees this overflowed the call stack during project close (RigMainGrid destruction). Replace the recursion with an explicit stack. Deleting an internal node does not touch its children, so the child pointers are read before the node is deleted and the deletion order is irrelevant. Leaf nodes remain pooled and are not deleted individually.