Committing Avination's memleak fix-a-thon, installment #2

Ensure items coming off the lockless queue are released. Also ensure this
is done when the queue is cleared.
0.7.4.1
Melanie 2012-07-23 19:26:21 +01:00
parent 7d16d0664e
commit 55c1c10c0d
1 changed files with 10 additions and 1 deletions

View File

@ -101,6 +101,11 @@ namespace OpenSim.Framework
{
item = oldHeadNext.Item;
haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext);
if (haveAdvancedHead)
{
oldHeadNext.Item = default(T);
oldHead.Next = null;
}
}
}
}
@ -111,6 +116,10 @@ namespace OpenSim.Framework
public void Clear()
{
// ugly
T item;
while(count > 0)
Dequeue(out item);
Init();
}