Skip to content

Commit

Permalink
clear should also mark the heights as unset
Browse files Browse the repository at this point in the history
  • Loading branch information
wcharczuk committed Jul 15, 2024
1 parent 6c1652e commit 0e3c56e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions recompute_heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ func (rh *recomputeHeap) clear() {
rh.mu.Lock()
defer rh.mu.Unlock()

var next INode
for rh.numItems > 0 {
next, _ = rh.removeMinUnsafe()
next.Node().heightInRecomputeHeap = HeightUnset
}

rh.heights = make([]*recomputeHeapList, len(rh.heights))
rh.minHeight = 0
rh.maxHeight = 0
Expand Down

0 comments on commit 0e3c56e

Please sign in to comment.