Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/18/13 10:26:25 (12 years ago)
Author:
ascheibe
Message:

#2005

  • fixed naming of event handlers that were forgotten when the naming from experiment to job was changed
  • fixed some more memory leaks
Location:
branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3/HiveTasks
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3/HiveTasks/HiveTask.cs

    r8939 r9173  
    3636  [Item("Hive Task", "Represents a hive task.")]
    3737  [StorableClass]
    38   public class HiveTask : NamedItem, IItemTree<HiveTask> {
     38  public class HiveTask : NamedItem, IItemTree<HiveTask>, IDisposable {
    3939    protected static object locker = new object();
    4040    protected ReaderWriterLockSlim childHiveTasksLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
     
    6767      set {
    6868        if (task != value) {
    69           DeregisterJobEvents();
     69          DeregisterTaskEvents();
    7070          task = value;
    71           RegisterJobEvents();
     71          RegisterTaskEvents();
    7272          IsFinishedTaskDownloaded = false;
    7373          OnTaskChanged();
     
    9393          itemTaskLock.EnterWriteLock();
    9494          try {
    95             DergisterItemTaskEvents();
     95            DeregisterItemTaskEvents();
    9696            itemTask = value;
    9797            RegisterItemTaskEvents();
     
    177177      this.childHiveTasks = new ItemList<HiveTask>();
    178178      syncTasksWithOptimizers = true;
    179       RegisterChildHiveJobEvents();
     179      RegisterChildHiveTasksEvents();
    180180    }
    181181
     
    198198      this.childHiveTasks = new ItemList<HiveTask>();
    199199      this.syncTasksWithOptimizers = true;
    200       RegisterChildHiveJobEvents();
     200      RegisterChildHiveTasksEvents();
    201201    }
    202202
     
    226226      }
    227227    }
    228     protected virtual void DergisterItemTaskEvents() {
     228    protected virtual void DeregisterItemTaskEvents() {
    229229      if (ItemTask != null) {
    230230        ItemTask.ComputeInParallelChanged -= new EventHandler(ItemJob_ComputeInParallelChanged);
     
    233233    }
    234234
    235     protected virtual void RegisterChildHiveJobEvents() {
     235    protected virtual void RegisterChildHiveTasksEvents() {
    236236      this.childHiveTasks.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<HiveTask>>(OnItemsAdded);
    237237      this.childHiveTasks.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<HiveTask>>(OnItemsRemoved);
    238238      this.childHiveTasks.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<HiveTask>>(OnCollectionReset);
    239239    }
    240     protected virtual void DeregisterChildHiveJobEvents() {
     240    protected virtual void DeregisterChildHiveTasksEvents() {
    241241      this.childHiveTasks.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<HiveTask>>(OnItemsAdded);
    242242      this.childHiveTasks.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<HiveTask>>(OnItemsRemoved);
     
    342342    }
    343343
    344     private void RegisterJobEvents() {
     344    private void RegisterTaskEvents() {
    345345      if (task != null)
    346346        task.PropertyChanged += new PropertyChangedEventHandler(task_PropertyChanged);
    347347    }
    348348
    349     private void DeregisterJobEvents() {
     349    private void DeregisterTaskEvents() {
    350350      if (task != null)
    351351        task.PropertyChanged += new PropertyChangedEventHandler(task_PropertyChanged);
     
    526526      this.ItemTask.Item = null;
    527527    }
     528
     529    public void Dispose() {
     530      DeregisterChildHiveTasksEvents();
     531      DeregisterTaskEvents();
     532      DeregisterItemTaskEvents();
     533      childHiveTasksLock.Dispose();
     534      itemTaskLock.Dispose();
     535    }
    528536  }
    529537
  • branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3/HiveTasks/OptimizerHiveTask.cs

    r8939 r9173  
    107107      }
    108108    }
    109     protected override void DergisterItemTaskEvents() {
    110       base.DergisterItemTaskEvents();
     109    protected override void DeregisterItemTaskEvents() {
     110      base.DeregisterItemTaskEvents();
    111111      if (ItemTask != null) {
    112112        if (ItemTask.Item is Optimization.Experiment) {
Note: See TracChangeset for help on using the changeset viewer.