aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/LayoutingQueueItem.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-21 16:11:30 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-21 16:11:30 +0100
commitb53838e9a4ba58b162640cabdf7d8070e3363a6b (patch)
tree16c433a1a9b2d85fa5e96c84cabeb2991656948b /src/LayoutingQueueItem.cs
parentb1847227f66d96f3074718ba4c9cdf8ee8ec8b36 (diff)
implement ReaderWritelLockSlim to resolve threading issues
Diffstat (limited to 'src/LayoutingQueueItem.cs')
-rw-r--r--src/LayoutingQueueItem.cs12
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)