Make sure handles stay intact when removing from the MinHeap

avinationmerge
Melanie 2012-07-11 04:01:20 +02:00
parent 7836933133
commit ac3a2296fa
1 changed files with 8 additions and 5 deletions

View File

@ -63,12 +63,15 @@ namespace OpenSim.Framework
internal void Clear() internal void Clear()
{ {
this.value = default(T);
if (this.handle != null) if (this.handle != null)
{
this.handle.Clear(); 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) if (--this.size > 0 && index != this.size)
{ {
Set(this.items[this.size], index); Set(this.items[this.size], index);
this.items[this.size].Clear(); this.items[this.size].ClearRef();
if (!BubbleUp(index)) if (!BubbleUp(index))
BubbleDown(index); BubbleDown(index);
} }