RecyclableLongList.Remove & .RemoveAt fixed to correctly set _lastBlockWithData to -1, when we remove the last item.

This commit is contained in:
mlemanczyk committed 2023-08-05 19:18:13 +02:00
1 parent 268dbb5b1d
commit 5a2ae1c261
1 file changed
+18 -12
+18 -12
View File
@@ -921,10 +921,7 @@ namespace Recyclable.Collections
if (_nextItemIndex > 0)
{
if (--_nextItemIndex == 0)
{
_lastBlockWithData--;
}
_nextItemIndex--;
}
else
{
@@ -932,6 +929,11 @@ namespace Recyclable.Collections
_nextItemBlockIndex--;
}
if (_nextItemIndex == 0)
{
_lastBlockWithData--;
}
if (NeedsClearing)
{
#nullable disable
@@ -987,10 +989,7 @@ namespace Recyclable.Collections
if (_nextItemIndex > 0)
{
if (--_nextItemIndex == 0)
{
_lastBlockWithData--;
}
_nextItemIndex--;
}
else
{
@@ -998,6 +997,11 @@ namespace Recyclable.Collections
_nextItemBlockIndex--;
}
if (_nextItemIndex == 0)
{
_lastBlockWithData--;
}
if (NeedsClearing)
{
#nullable disable
@@ -1023,10 +1027,7 @@ namespace Recyclable.Collections
if (_nextItemIndex > 0)
{
if (--_nextItemIndex == 0)
{
_lastBlockWithData--;
}
_nextItemIndex--;
}
else
{
@@ -1034,6 +1035,11 @@ namespace Recyclable.Collections
_nextItemBlockIndex--;
}
if (_nextItemIndex == 0)
{
_lastBlockWithData--;
}
if (NeedsClearing)
{
#nullable disable