Merge branch 'ConnectPro_v1.3' into ConnectPro_v1.4

This commit is contained in:
Chris Cameron
2019-10-29 14:58:27 -04:00
2 changed files with 5 additions and 21 deletions

View File

@@ -128,6 +128,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Better VC-4 support for IcdConsole - Better VC-4 support for IcdConsole
- JSON refactoring for simpler deserialization - JSON refactoring for simpler deserialization
## [8.7.2] - 2019-10-29
### Changed
- Fixed a bug with PriorityQueue de-duplication where a new command would be inserted in the wrong position
## [8.7.1] - 2019-08-22 ## [8.7.1] - 2019-08-22
### Changed ### Changed
- Fixed a bug with the IcdOrderedDict index setter that was creating additional values - Fixed a bug with the IcdOrderedDict index setter that was creating additional values

View File

@@ -121,8 +121,6 @@ namespace ICD.Common.Utils.Collections
if (remove == null) if (remove == null)
throw new ArgumentNullException("remove"); throw new ArgumentNullException("remove");
bool inserted = false;
foreach (KeyValuePair<int, List<T>> kvp in m_PriorityToQueue.ToArray()) foreach (KeyValuePair<int, List<T>> kvp in m_PriorityToQueue.ToArray())
{ {
int[] removeIndices = int[] removeIndices =
@@ -131,35 +129,17 @@ namespace ICD.Common.Utils.Collections
.Reverse() .Reverse()
.ToArray(); .ToArray();
if (removeIndices.Length == 0)
continue;
foreach (int removeIndex in removeIndices) foreach (int removeIndex in removeIndices)
{ {
kvp.Value.RemoveAt(removeIndex); kvp.Value.RemoveAt(removeIndex);
m_Count--; m_Count--;
} }
if (!inserted)
{
int insertIndex = removeIndices[0];
if (insertIndex >= kvp.Value.Count)
kvp.Value.Add(item);
else
kvp.Value.Insert(insertIndex, item);
m_Count++;
inserted = true;
}
if (kvp.Value.Count == 0) if (kvp.Value.Count == 0)
m_PriorityToQueue.Remove(kvp.Key); m_PriorityToQueue.Remove(kvp.Key);
} }
if (!inserted) Enqueue(item, priority);
Enqueue(item, priority);
} }
/// <summary> /// <summary>