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 | 05e7cd5133826afd42d215e08c4874ee48ed49be (patch) | |
| tree | 2f449777278cc8b4805a4e80d7ee81b3863bc4a1 /src/LayoutingQueueItem.cs | |
| parent | 30b49efa1763ebdfe82f9d69e0e7bafcdd3b25a8 (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) |