diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-21 16:11:30 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-21 16:11:30 +0100 |
| commit | b53838e9a4ba58b162640cabdf7d8070e3363a6b (patch) | |
| tree | 16c433a1a9b2d85fa5e96c84cabeb2991656948b /src/LayoutingQueueItem.cs | |
| parent | b1847227f66d96f3074718ba4c9cdf8ee8ec8b36 (diff) | |
implement ReaderWritelLockSlim to resolve threading issues
Diffstat (limited to 'src/LayoutingQueueItem.cs')
| -rw-r--r-- | src/LayoutingQueueItem.cs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index e87c4146..ba2f95af 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -97,12 +97,21 @@ namespace Crow public void ProcessLayouting() { - if (Layoutable.Parent == null) {//TODO:improve this + GraphicObject go = Layoutable as GraphicObject; + if (go == null) { + Debug.WriteLine ("ERROR: processLayouting on something else than a graphic object: " + this.ToString ()); + return; + } + + go.parentRWLock.EnterReadLock (); + + if (go.Parent == null) {//TODO:improve this //cancel layouting for object without parent, maybe some were in queue when //removed from a listbox #if DEBUG_UPDATE || DEBUG_LAYOUTING Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ()); #endif + go.parentRWLock.ExitReadLock (); return; } #if DEBUG_LAYOUTING @@ -138,6 +147,7 @@ namespace Crow } LQITime.Stop(); #endif + go.parentRWLock.ExitReadLock (); } public static implicit operator GraphicObject(LayoutingQueueItem queueItem) |