From 0e3c56e23ad96396816da401ace4eb6c66477c5d Mon Sep 17 00:00:00 2001 From: Will Charczuk Date: Mon, 15 Jul 2024 13:22:48 -0700 Subject: [PATCH] clear should also mark the heights as unset --- recompute_heap.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recompute_heap.go b/recompute_heap.go index 7e979e8..37adae9 100644 --- a/recompute_heap.go +++ b/recompute_heap.go @@ -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