Commit b3c887e2 authored by Nicholas Little's avatar Nicholas Little Committed by Andrés G. Aragoneses

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=d835de9ebc75bf937aa66d45909cb5eb119249e0Signed-off-by: 's avatarAndrés G. Aragoneses <knocte@gmail.com>
parent 770a1ef2
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment