GNOME Bugzilla – Bug 547092
Dragging a track from mirage to a playlist crashes banshee
Last modified: 2008-08-16 10:16:35 UTC
What steps will reproduce the problem ? 1. Select a track in the mirage track list 2. Drag and drop it to the play queue or a playlist Banshee crashes with this stacktrace : Object reference not set to an instance of an object System.NullReferenceException: Object reference not set to an instance of an object at Banshee.Sources.DatabaseSource.WithTrackSelection (Banshee.Collection.Database.DatabaseTrackListModel model, Banshee.Sources.TrackRangeHandler handler) [0x00000] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs:606 at Banshee.Sources.DatabaseSource.AddSelectedTracks (Banshee.Sources.Source source) [0x0001f] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs:417 at Banshee.Playlist.PlaylistSource.AddSelectedTracks (Banshee.Sources.Source source) [0x00028] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs:236 at Banshee.Sources.DatabaseSource.MergeSourceInput (Banshee.Sources.Source source, SourceMergeType mergeType) [0x00022] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs:472 at Banshee.Sources.Gui.SourceView.OnDragDataReceived (Gdk.DragContext context, Int32 x, Int32 y, Gtk.SelectionData data, UInt32 info, UInt32 time) [0x00146] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs:231 at Gtk.Widget.dragdatareceived_cb (IntPtr widget, IntPtr context, Int32 x, Int32 y, IntPtr selection_data, UInt32 info, UInt32 time_) [0x00000] at (wrapper native-to-managed) Gtk.Widget:dragdatareceived_cb (intptr,intptr,int,int,intptr,uint,uint) at (wrapper managed-to-native) Gtk.Application:gtk_main () at Gtk.Application.Run () [0x00000] at Banshee.Gui.GtkBaseClient.Run () [0x00027] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:114 at Banshee.Gui.GtkBaseClient.Startup () [0x00000] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:55 at Hyena.Gui.CleanRoomStartup.Startup (Hyena.Gui.StartupInvocationHandler startup) [0x00048] in /var/tmp/portage/media-sound/banshee-1.2.0/work/banshee-1-1.2.0/src/Libraries/Hyena.Gui/Hyena.Gui/CleanRoomStartup.cs:54 The crash happens because banshee assumes the track comes from a source that has a DatabaseTrackListModel. Mirage uses a MemoryTrackListModel. Other sources that currently use a MemoryTrackListModel don't allow drag and drop, so they are not affected. I'll attach a patch that prevents the crash.
Created attachment 116258 [details] [review] Check if the model is null Simple patch to check if the cast of the TrackModel to DatabaseTrackListModel succeeded.
Committed.