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
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 :-)
note2: extremely likely that this is the cause of random crashes when
player goes to next track.. also, the bugzilla entry for the randomized
play, deleting items, crash!
// if the metadata thread is still accessing this item
// we don't wanna delete the item out from under it.
// instead we set a flag and let the metadata thread
// clean up when it returns.
if(item->GetState() == kPlaylistItemState_RetrievingMetaData)