From ac3a2296fa6de7ad07f862fbe073e9e3495677f1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 11 Jul 2012 04:01:20 +0200 Subject: [PATCH] Make sure handles stay intact when removing from the MinHeap --- OpenSim/Framework/MinHeap.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs index f2218c905a..99ac25d09d 100644 --- a/OpenSim/Framework/MinHeap.cs +++ b/OpenSim/Framework/MinHeap.cs @@ -63,12 +63,15 @@ namespace OpenSim.Framework internal void Clear() { - this.value = default(T); if (this.handle != null) - { this.handle.Clear(); - this.handle = null; - } + ClearRef(); + } + + internal void ClearRef() + { + this.value = default(T); + this.handle = null; } } @@ -285,7 +288,7 @@ namespace OpenSim.Framework if (--this.size > 0 && index != this.size) { Set(this.items[this.size], index); - this.items[this.size].Clear(); + this.items[this.size].ClearRef(); if (!BubbleUp(index)) BubbleDown(index); }