Hi Banshee developers I am currently writing a new INotify plugin for Banshee based on the inotify glue from novell (used in the muine inotify plugin, among others). I am actually completely new to Banshee (and to C#, for that matter) so please accept my apologies if my question is naive. Any help would be appreciated. There seems to be a problem with the handling of LibraryTrackRemovedArgs. My plugin's code for handling file deletion is basically as follows: case Inotify.EventType.Delete: SafeUri uri = new SafeUri(SafeUri.FilenameToUri(path)); string fnkey = Banshee.Base.Library.MakeFilenameKey(uri); LibraryTrackInfo track = Globals.Library.TracksFnKeyed[fnkey] as LibraryTrackInfo; LogCore.Instance.PushDebug("Delete track " + track, ""); Globals.Library.Remove(track); break; This makes Banshee crash, complaining about a null object reference in SmartPlaylistCore.HandleTrackRemoved(). The args.Tracks field accessed in that method indeed is null. The Library.Remove() method apparently assigns args.Track but NOT args.Tracks. As a temporary fix I'm using the following patch: private void HandleTrackRemoved (object sender, LibraryTrackRemovedArgs args) { // When calling Library.Remove(), args.Tracks is null if (args.Track != null) args.Track.Changed -= HandleTrackChanged; if (args.Tracks != null) foreach (TrackInfo track in args.Tracks) if (track != null) track.Changed -= HandleTrackChanged; } This works but leaves me with two questions: 1) I am probably missing something...? 2) Why are there two fields LibraryTrackRemovedArgs.Track and LibraryTrackRemovedArgs.Tracks, anyway? Thanks in advance! Jacob ________________________________________________________________________ Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
Attachment:
signature.asc
Description: This is a digitally signed message part