Commit 0ec531f3 authored by Scott Wheeler's avatar Scott Wheeler

Remove items from the PlaylistSearch's lists when they're cleared from the

playlists.

svn path=/trunk/kdemultimedia/juk/; revision=323718
parent 7f1e334f
......@@ -521,6 +521,8 @@ void Playlist::clearItem(PlaylistItem *item, bool emitChanged)
{
emit signalAboutToRemove(item);
m_members.remove(item->file().absFilePath());
m_search.clearItem(item);
if(!m_randomList.isEmpty() && !m_visibleChanged)
m_randomList.remove(item);
delete item;
......
......@@ -116,6 +116,13 @@ bool PlaylistSearch::isEmpty() const
return true;
}
void PlaylistSearch::clearItem(PlaylistItem *item)
{
m_items.remove(item);
m_matchedItems.remove(item);
m_unmatchedItems.remove(item);
}
////////////////////////////////////////////////////////////////////////////////
// Component public methods
////////////////////////////////////////////////////////////////////////////////
......
......@@ -61,6 +61,13 @@ public:
bool isNull() const { return m_components.isEmpty(); }
bool isEmpty() const;
/**
* This is used to clear an item from the matched and unmatched lists. This
* is useful because it can prevent keeping a dangling pointer around without
* requiring invalidating the search.
*/
void clearItem(PlaylistItem *item);
private:
PlaylistList m_playlists;
ComponentList m_components;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment