Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d9447994 authored by Michael Pyne's avatar Michael Pyne

Fix bug 89324 (Juk crashes guessing tags in a tree view folder with only one item).

I hacked around it by preventing the tree view mode playlists from being deleted while guessing the tags.

Note that you can still conceivably cause this crash by guessing the tag using the Internet in some rare cases.

CCMAIL:89324-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=346642
parent ad0c9724
......@@ -679,12 +679,14 @@ void Playlist::slotGuessTagInfo(TagGuesser::Type type)
{
KApplication::setOverrideCursor(Qt::waitCursor);
PlaylistItemList items = selectedItems();
setCanDeletePlaylist(false);
for(PlaylistItemList::Iterator it = items.begin(); it != items.end(); ++it) {
(*it)->guessTagInfo(type);
processEvents();
}
dataChanged();
setCanDeletePlaylist(true);
KApplication::restoreOverrideCursor();
}
......@@ -1128,6 +1130,11 @@ void Playlist::setupItem(PlaylistItem *item)
}
}
void Playlist::setCanDeletePlaylist(bool canDelete)
{
m_collection->setCanDeletePlaylist(canDelete);
}
////////////////////////////////////////////////////////////////////////////////
// protected slots
////////////////////////////////////////////////////////////////////////////////
......
......@@ -403,6 +403,12 @@ protected:
*/
void setupItem(PlaylistItem *item);
/**
* Forwards the call to the parent to enable or disable automatic deletion
* of tree view playlists. Used by CollectionListItem.
*/
void setCanDeletePlaylist(bool canDelete);
/**
* As a template this allows us to use the same code to initialize the items
* in subclasses. CollectionItemType should always be CollectionListItem and
......
......@@ -339,6 +339,14 @@ void PlaylistBox::remove()
}
}
void PlaylistBox::setCanDeletePlaylist(bool canDelete)
{
TreeViewMode *treeView = dynamic_cast<TreeViewMode *>(m_viewModes[2]);
if(treeView)
treeView->slotCanDeletePlaylist(canDelete);
}
void PlaylistBox::slotPlaylistDestroyed(Playlist *p)
{
emit signalPlaylistDestroyed(p);
......
......@@ -59,6 +59,8 @@ public:
virtual void duplicate();
virtual void remove();
virtual void setCanDeletePlaylist(bool canDelete);
Item *dropItem() const { return m_dropItem; }
public slots:
......
......@@ -319,6 +319,11 @@ void PlaylistCollection::editSearch()
}
}
void PlaylistCollection::setCanDeletePlaylist(bool canDelete)
{
// Implemented in subclass
}
void PlaylistCollection::removeItems()
{
currentPlaylist()->slotRemoveSelectedItems();
......
......@@ -74,6 +74,7 @@ public:
virtual void remove();
virtual void reload();
virtual void editSearch();
virtual void setCanDeletePlaylist(bool canDelete);
void enableDirWatch(bool enable);
......
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