Changeset 13519


Ignore:
Timestamp:
01/15/16 18:08:31 (5 years ago)
Author:
bburlacu
Message:

#1772: Fix cloning of CloneableCollection to avoid a stack overflow exception in some cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Collections/CloneableCollection.cs

    r11925 r13519  
    2929    public CloneableCollection(IEnumerable<T> elements) : base(elements) { }
    3030
    31     public object Clone() { return new CloneableCollection<T>(this); }
     31    public CloneableCollection(CloneableCollection<T> original, Cloner cloner) : base(original) {
     32      cloner.RegisterClonedObject(original, this);
     33    }
    3234
    33     public IDeepCloneable Clone(Cloner cloner) { return cloner.Clone(this); }
     35    public object Clone() { return Clone(new Cloner()); }
     36
     37    public IDeepCloneable Clone(Cloner cloner) { return new CloneableCollection<T>(this, cloner); }
    3438  }
    3539
Note: See TracChangeset for help on using the changeset viewer.