Re: [Banshee-List] Porting the Mirage plugin to the new banshee codebase



On Sun, 2008-06-08 at 23:24 -0500, Gabriel Burt wrote:
> 2008/6/7 Bertrand Lorentz <bertrand lorentz gmail com>:
> > On Sat, 2008-06-07 at 14:24 -0500, Gabriel Burt wrote:
> >> 2008/6/7 Bertrand Lorentz <bertrand lorentz gmail com>:
> >> > I'd like to let you know that I've started to work on porting Mirage to
> >> > the latest banshee code.
> >> > I got it to compile, and now it is happily crashing banshee on startup.
> >> > I must be doing something wrong when I'm adding the Source to the
> >> > MusicLibrary. I'm accepting suggestion ! ;)
> >>
> >> Very cool!  Still stuck?  What's the error?
> >
> > The error is because I'm adding a child source to the MusicLibrary while
> > other child sources (my smart playlists) are also being added.
> > System.Collections was complaining on line 170 of SourceManager.cs.
> >
> > I guess I need to wait until the MusicLibrary has been completly
> > loaded, with its children.
> > The only way I've found for now is to wait until the VideoLibrary starts
> > loading (it starts after MusicLibrary is finished)...
> >
> > There's probably a much better way, so enlighten me ! ;)
> 
> What exception is being thrown?  Sounds like a bug that should be fixed.

After removing the ridiculous work-around described above, here's the
log and exception I have :

----------------------------------------------
[Debug 20:59:54.093] Mirage: new source
[Debug 20:59:54.096] Mirage: add source
Collection was modified;enumeration operation may not execute.
System.InvalidOperationException: Collection was modified;enumeration
operation may not execute.
  at System.Collections.Generic.List`1
+Enumerator[Banshee.Sources.Source].MoveNext () [0x00069]
in /var/tmp/portage/dev-lang/mono-1.2.6-r2/work/mono-1.2.6/mcs/class/corlib/System.Collections.Generic/List.cs:768 
  at Banshee.Sources.SourceManager.AddSource (Banshee.Sources.Source
source, Boolean isDefault) [0x000e8]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs:172 
  at Banshee.ServiceStack.Application.Run () [0x00023]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs:83 
  at Banshee.Gui.GtkBaseClient.Initialize (Boolean
registerCommonServices) [0x000b7]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:106 
  at Banshee.Gui.GtkBaseClient..ctor (Boolean initializeDefault,
System.String defaultIconName) [0x00013]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:68 
  at Banshee.Gui.GtkBaseClient..ctor () [0x00000]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:60 
  at Nereid.Client..ctor () [0x00000] 
  at (wrapper managed-to-native)
System.Reflection.MonoCMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoCMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x0003f]
in /var/tmp/portage/dev-lang/mono-1.2.6-r2/work/mono-1.2.6/mcs/class/corlib/System.Reflection/MonoMethod.cs:400 

Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object
  at Hyena.Data.Gui.ListView`1[Banshee.Collection.ArtistInfo].PaintRows
(Rectangle ) [0x00118]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:191 
  at
Hyena.Data.Gui.ListView`1[Banshee.Collection.ArtistInfo].OnExposeEvent
(Gdk.EventExpose ) [0x000d3]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:88 
  at Gtk.Widget.exposeevent_cb (IntPtr widget, IntPtr evnt) [0x00000] 
  at (wrapper native-to-managed) Gtk.Widget:exposeevent_cb
(intptr,intptr)
  at (wrapper managed-to-native) Gtk.Dialog:gtk_dialog_run (intptr)
  at Gtk.Dialog.Run () [0x00000] 
  at Hyena.Gui.CleanRoomStartup.Startup
(Hyena.Gui.StartupInvocationHandler startup) [0x00076]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Libraries/Hyena.Gui/Hyena.Gui/CleanRoomStartup.cs:61 
  at Banshee.Gui.GtkBaseClient.Entry[Client] () [0x00024]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:50 
  at Nereid.Client.Main (System.String[] args) [0x0009b]
in /var/tmp/portage/media-sound/banshee-1.0.0/work/banshee-1-1.0.0/src/Clients/Nereid/Nereid/Client.cs:77 
------------------------------------------------------

And here's the relevant bits of code from the mirage plugin
initialization :

------------------------------------------------------
    void IExtensionService.Initialize ()
    {
        <...>
        ServiceManager.SourceManager.SourceAdded += OnSourceAdded;
    }

    private void OnSourceAdded (SourceAddedArgs args)
    {
        ServiceStartup ();
    }
        
    private bool ServiceStartup ()
    {
        if (ServiceManager.SourceManager.MusicLibrary == null) {
            return false;
        }
        
        if (continuousPlaylist == null) {
            <....>    
            Log.Debug("Mirage: new source");
            continuousPlaylist = new
ContinuousGeneratorSource("Playlist Generator", db);
                
            Log.Debug("Mirage: add source");
ServiceManager.SourceManager.MusicLibrary.AddChildSource(continuousPlaylist);
        }
        return true;
    }
------------------------------------------------------


-- 
Bertrand Lorentz <bertrand lorentz gmail com>
> http://flickr.com/photos/bl8/ <

Attachment: signature.asc
Description: This is a digitally signed message part



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