Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3798 for trunk/sources


Ignore:
Timestamp:
05/13/10 17:31:13 (15 years ago)
Author:
gkronber
Message:

Implemented fix for exceptions in CheckedItemCollection and CheckedItemCollection. #893

Location:
trunk/sources/HeuristicLab.Core/3.3/Collections
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Collections/CheckedItemCollection.cs

    r3628 r3798  
    127127    protected override void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) {
    128128      foreach (var oldItem in oldItems)
    129         checkedState.Remove(oldItem);
     129        if (!list.Contains(oldItem))
     130          checkedState.Remove(oldItem);
    130131      foreach (var item in items)
    131132        if (!checkedState.ContainsKey(item))
     
    151152    protected override void OnItemsRemoved(IEnumerable<T> items) {
    152153      foreach (var item in items) {
    153         checkedState.Remove(item);
     154        if (!list.Contains(item))
     155          checkedState.Remove(item);
    154156      }
    155157      base.OnItemsRemoved(items);
  • trunk/sources/HeuristicLab.Core/3.3/Collections/CheckedItemList.cs

    r3628 r3798  
    163163    protected override void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) {
    164164      foreach (var oldIndexedItem in oldItems) {
    165         checkedState.Remove(oldIndexedItem.Value);
     165        if (!list.Contains(oldIndexedItem.Value))
     166          checkedState.Remove(oldIndexedItem.Value);
    166167      }
    167168      foreach (var indexedItem in items) {
     
    189190    protected override void OnItemsRemoved(IEnumerable<IndexedItem<T>> items) {
    190191      foreach (var indexedItem in items)
    191         checkedState.Remove(indexedItem.Value);
     192        if (!list.Contains(indexedItem.Value))
     193          checkedState.Remove(indexedItem.Value);
    192194      base.OnItemsRemoved(items);
    193195    }
     
    200202    protected override void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) {
    201203      foreach (var oldIndexedItem in oldItems)
    202         checkedState.Remove(oldIndexedItem.Value);
     204        if (!list.Contains(oldIndexedItem.Value))
     205          checkedState.Remove(oldIndexedItem.Value);
    203206      foreach (var indexedItem in items)
    204207        if (!checkedState.ContainsKey(indexedItem.Value))
Note: See TracChangeset for help on using the changeset viewer.