Commit d835de9e authored by Andres G. Aragoneses's avatar Andres G. Aragoneses

SourceView: log errors in SetCellDataFunc to avoid crashing (bgo#683359)

There must be a tricky problem about model.GetValue() not returning
proper values the first times it is queried. It is an issue hard
to reproduce so this is not a proper fix, but just rather a call
to Log.Error to prevent crashing.

(Banshee is able to run normally after a few times this error
condition happens and gets logged, as tested by Andy Goar.)
Signed-off-by: Bertrand Lorentz's avatarBertrand Lorentz <>
parent 22abec46
......@@ -134,7 +134,24 @@ namespace Banshee.Sources.Gui
throw new ArgumentNullException ("model");
var type = (SourceModel.EntryType) model.GetValue (iter, (int)SourceModel.Columns.Type);
// be paranoid about the values returned from model.GetValue(), they may be null or have unexpected types, see bgo#683359
var obj_type = model.GetValue (iter, (int)SourceModel.Columns.Type);
if (obj_type == null || !(obj_type is SourceModel.EntryType)) {
var source = model.GetValue (iter, (int)SourceModel.Columns.Source) as Source;
var source_name = source == null ? "some source" : String.Format ("source {0}", source.Name);
Log.ErrorFormat (
"SourceView of {0} could not render its source column because its type value returned {1} from the iter",
source_name, obj_type == null ? "null" : String.Format ("an instance of {0}", obj_type.GetType ().FullName));
header_renderer.Visible = false;
source_renderer.Visible = false;
var type = (SourceModel.EntryType) obj_type;
header_renderer.Visible = type == SourceModel.EntryType.Group;
source_renderer.Visible = type == SourceModel.EntryType.Source;
if (type == SourceModel.EntryType.Group) {
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