Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/19/11 13:30:38 (14 years ago)
Author:
mkommend
Message:

#1488: Added lock around critical region in cloning ctor of OperatorShapeInfo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfo.cs

    r5445 r6029  
    3232    [Storable]
    3333    private List<string> labels;
     34
     35    private object lockObject = new object();
    3436
    3537    [StorableConstructor]
     
    4244      lineWidth = original.lineWidth;
    4345      title = original.title;
    44       if (original.icon != null) icon = (Bitmap)original.icon.Clone();
     46
     47      //mkommend: necessary because cloning a Bitmap is not threadsafe
     48      //see http://stackoverflow.com/questions/1851292/invalidoperationexception-object-is-currently-in-use-elsewhere for further information
     49      if (original.icon != null) {
     50        lock (lockObject) {
     51          icon = (Bitmap)original.icon.Clone();
     52        }
     53      }
    4554
    4655      connectorNames = new List<string>(original.connectorNames);
     
    231240      this.Icon = operatorShape.Icon;
    232241      this.Collapsed = operatorShape.Collapsed;
    233 
    234       //TODO update Connector and labels;
    235242    }
    236243  }
Note: See TracChangeset for help on using the changeset viewer.