[banshee] ThickClient: avoid null values returned from iters in models (bgo#683359)



commit b3c887e23ac92625a425baa3891897b5fa39118c
Author: Nicholas Little <arealityfarbetween googlemail com>
Date:   Mon Dec 15 02:37:57 2014 +0100

    ThickClient: avoid null values returned from iters in models (bgo#683359)
    
    Some time ago a workaround was committed to avoid banshee crashes
    when the values of model iterators were null [1]. The root of the
    issue was that there was a small time-window in between the calls
    to InsertNode() and SetValue() in which the iter could be queried
    and its value would not be found. The way to fix this is to provide
    the values in the same call that inserts the node, via the
    InsertWithValues() method from the API.
    
    [1] https://git.gnome.org/browse/banshee/commit/?id=d835de9ebc75bf937aa66d45909cb5eb119249e0
    
    Signed-off-by: Andrés G. Aragoneses <knocte gmail com>

 .../Banshee.Sources.Gui/SourceModel.cs             |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs 
b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
index 6569317..a8fdb98 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
@@ -214,13 +214,15 @@ namespace Banshee.Sources.Gui
 
                 int position = source.Order;
 
-                TreeIter iter = parent.Equals (TreeIter.Zero)
-                    ? InsertNode (position)
-                    : InsertNode (parent, position);
+                var args = new object [] {
+                    source,
+                    position,
+                    source is SourceManager.GroupSource ? EntryType.Group : EntryType.Source
+                };
 
-                SetValue (iter, 0, source);
-                SetValue (iter, 1, source.Order);
-                SetValue (iter, 2, source is SourceManager.GroupSource ? EntryType.Group : EntryType.Source);
+                TreeIter iter = parent.Equals (TreeIter.Zero)
+                    ? InsertWithValues (position, args)
+                    : InsertWithValues (parent, position, args);
 
                 lock (source.Children) {
                     foreach (Source child in source.Children) {


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