From 46f593f8d2a9c76b582720e0a44af3075f879a93 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Sun, 7 Feb 2016 15:44:25 +0100 Subject: [PATCH] prevent RegisterForLayouting when parent is null, and dequeue LQI when parent of GO is null --- src/GraphicObjects/GraphicObject.cs | 4 +++- src/LayoutingQueueItem.cs | 16 +++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 40f5dcf7..d04c94d7 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -386,7 +386,7 @@ namespace Crow get { return _maximumSize; } set { _maximumSize = value; } } - [XmlAttributeAttribute()][DefaultValue("0;0")] + [XmlAttributeAttribute()][DefaultValue("1;1")] public virtual Size MinimumSize { get { return _minimumSize; } set { _minimumSize = value; } @@ -503,6 +503,8 @@ namespace Crow } public virtual void RegisterForLayouting(LayoutingType layoutType){ + if (Parent == null) + return; //dont set position for stretched item if (Width == 0) layoutType &= (~LayoutingType.X); diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index d5ad7fcc..ef787d35 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -55,16 +55,14 @@ namespace Crow Debug.WriteLine ("Layouting => " + this.ToString ()); #endif - try { - if (GraphicObject.Parent == null){ - Debug.WriteLine("ERROR: processLayouting, no parent for: " + GraphicObject.ToString()); - return; - } - if (!GraphicObject.UpdateLayout (LayoutType)) - Interface.LayoutingQueue.Enqueue(this); - } catch (Exception ex) { - Debug.WriteLine ("Layouting error: " + ex.ToString ()); + if (GraphicObject.Parent == null) { + //cancel layouting for object without parent, maybe some were in queue when + //removed from a listbox + Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ()); + return; } + if (!GraphicObject.UpdateLayout (LayoutType)) + Interface.LayoutingQueue.Enqueue(this); } public static implicit operator GraphicObject(LayoutingQueueItem queueItem) -- 2.47.3