]> O.S.I.I.S - jp/crow.git/commitdiff
prevent RegisterForLayouting when parent is null, and dequeue LQI when parent of...
authorjpbruyere <jp.bruyere@hotmail.com>
Sun, 7 Feb 2016 14:44:25 +0000 (15:44 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sun, 7 Feb 2016 14:44:25 +0000 (15:44 +0100)
src/GraphicObjects/GraphicObject.cs
src/LayoutingQueueItem.cs

index 40f5dcf71f27e719e88e1d4aaa275d63161dc4b5..d04c94d75ae511da874fc36d47fec7cca9e45246 100644 (file)
@@ -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);
index d5ad7fcc57afc75fdf59c8492a06f91bb20c407a..ef787d3559afb9844ce7c8cf4044949a5d5c7d60 100644 (file)
@@ -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)