[banshee] [ListView_Header] hack to work around endless loop



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

    [ListView_Header] 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/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
index 4e699d5..8482938 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
+++ b/src/Libraries/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]