[hyena] hack to work around endless loop



commit b1f96d8268f76da0d3e99821d823a60c32336676
Author: Aaron Bockover <abockover novell com>
Date:   Tue Feb 16 20:46:54 2010 -0500

    hack to work around endless loop
    
    If a column size is ever computed to be 0, which is possible in the rare
    case where only one flexible column will be visible, and sizing is just
    right for computing the flexible scale value to be 1/col, later in the
    column size calculations, this 0 value will cause other values to become
    NaN, which will then result in a lovely infinite loop.
    
    When applying the scale back, we arrive at this dreaded 0 value.
    
    This entire section of code needs some serious review as there's much
    that is not clearly understood here, but hey, it works (99.9% of the time
    at least), so I'm nervous about "fixing" it.

 .../Hyena.Data.Gui/ListView/ListView_Header.cs     |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
index f825fea..ea10f29 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
@@ -117,6 +117,10 @@ namespace Hyena.Data.Gui
 
             for (i = 0; i < column_cache.Length; i++) {
                 column_cache[i].Column.Width *= scale_factor;
+                if (column_cache[i].Column.Width <= 0) {
+                    Hyena.Log.Warning ("Overriding 0-computed column cache width");
+                    column_cache[i].Column.Width = 0.01;
+                }
             }
 
             RecalculateColumnSizes ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]