looked at the leaks both ways, didn't see much of a difference.
I'll give it about 20 songs to cycle through and see how many
it leaks.  Doesn't the thread callback do a little garbage collection
on the playlists that have been tagged for deletion?

-Jason


-----Original Message-----
From: Isaac Richards [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 13, 2001 10:44 AM
To: [EMAIL PROTECTED]
Subject: RE: PlaylistManager crashes -- stale items in playlist --
fixed!



On 13-Jan-2001 Jason Slater wrote:
> Hi all,
> 
> all of the remove functions in the playlist manager have the same bug:
> for example, in RemoveAll(), below, items are deleted and left in the
> playlists.  Bad.  This code will crash by repeatedly clicking on a
> given song in the playlist tree, which will toggle between RemoveAll(),
> adding the item, and playing it -- this finally gets hold of a deleted 
> entry and then crashes.  
> 
> I've modified the destructor for the PlaylistManager class, and changed
> all of the remove functions to simply set the items state to the 
> to-be-deleted state.  
> 
> the only 2 places that a PlaylistItem gets deleted are in 
> ~PlaylistManager and in the MetaDataThreadFunction()
>
> note: there were leaks in this code, and there still are.  But, with
> the changes I'm attaching, the crashes are gone :-)

Crashes are gone, but with this, it's going to leak massively if freeamp's
used for any length of time -- PlaylistItem's won't be deleted until program
exit, and that's not good.  Freeamp's already bloated enough =)

Hmmm..  probably, the easiest thing to do would be to make another object,
say,
the music catalog, own all the PlaylistItems, and only use references to
those
objects in the PlaylistManager class..  This would be a fairly simple change
(ie, don't create new PlaylistItems when adding from the catalog to the
playlist), but it doesn't cover the other ways tracks can get added to the
playlist.  Bleh.  We need a PlaylistItem storage class to own all instances
of
a track and stuff, but that's way too big of a change to do this late in the
2.1 release game, IMO.  

We just need to release 2.1 and throw out all the crufty stuff for 3.0 =)

Isaac
_______________________________________________
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev
_______________________________________________
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev

Reply via email to