Commit ba6ef6a1 authored by Michael Pyne's avatar Michael Pyne

Fix bug 90662 (Crash after editing tags of many songs) based on patch supplied by the bug reporter.

Also, if a playlist is deleted while it is selected, select the CollectionList since I don't think it's a great idea to have an invalid playlist be the current playlist.

I need to backport the bugfix later, but I don't have time now.

CCMAIL:90662@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=354376
parent 569f7dbe
......@@ -391,6 +391,11 @@ Playlist::~Playlist()
m_playingItem = 0;
delete m_toolTip;
// Select a different playlist if we're the selected one
if(isVisible() && this != CollectionList::instance())
m_collection->raise(CollectionList::instance());
}
QString Playlist::name() const
......
......@@ -158,6 +158,15 @@ void TagEditor::slotSetItems(const PlaylistItemList &list)
if(m_performingSave)
return;
// Store the playlist that we're setting because saveChangesPrompt
// can delete the PlaylistItems in list.
Playlist *itemPlaylist = 0;
if(!list.isEmpty())
itemPlaylist = list.first()->playlist();
bool hadPlaylist = m_currentPlaylist != 0;
saveChangesPrompt();
if(m_currentPlaylist) {
......@@ -165,7 +174,17 @@ void TagEditor::slotSetItems(const PlaylistItemList &list)
this, SLOT(slotItemRemoved(PlaylistItem *)));
}
m_currentPlaylist = list.isEmpty() ? 0 : static_cast<Playlist *>(list.first()->listView());
if(hadPlaylist && !m_currentPlaylist || !itemPlaylist) {
m_currentPlaylist = 0;
m_items.clear();
}
else {
m_currentPlaylist = itemPlaylist;
// We can't use list here, it may not be valid
m_items = itemPlaylist->selectedItems();
}
if(m_currentPlaylist) {
connect(m_currentPlaylist, SIGNAL(signalAboutToRemove(PlaylistItem *)),
......@@ -173,8 +192,6 @@ void TagEditor::slotSetItems(const PlaylistItemList &list)
connect(m_currentPlaylist, SIGNAL(destroyed()), this, SLOT(slotPlaylistRemoved()));
}
m_items = list;
if(isVisible())
slotRefresh();
else
......
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