Fix memory leak in playlistsmodel.

This commit is contained in:
craig
2012-01-10 21:21:43 +00:00
committed by craig
parent 99fcf7086a
commit 0ef5d8685f
2 changed files with 5 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
2. When editing a stream category name, show the current name in the entry
field.
3. Use KInputDialog, not QInputDiallog, for KDE build.
4. Fix memory leak in playlistsmodel.
0.2.0
-----

View File

@@ -436,7 +436,7 @@ void PlaylistsModel::setPlaylists(const QList<Playlist> &playlists)
if (pl) {
int index=items.indexOf(pl);
beginRemoveRows(parent, index, index);
items.removeAt(index);
delete items.takeAt(index);
endRemoveRows();
}
}
@@ -479,7 +479,7 @@ void PlaylistsModel::playlistInfoRetrieved(const QString &name, const QList<Song
// Remove all remaining...
beginRemoveRows(parent, i, count);
for (int j=i; j<count; ++j) {
pl->songs.removeAt(i);
delete pl->songs.takeAt(i);
}
endRemoveRows();
break;
@@ -491,7 +491,7 @@ void PlaylistsModel::playlistInfoRetrieved(const QString &name, const QList<Song
addFrom=i;
beginRemoveRows(parent, i, count);
for (int j=i; j<count; ++j) {
pl->songs.removeAt(i);
delete pl->songs.takeAt(i);
}
endRemoveRows();
break;
@@ -540,7 +540,7 @@ void PlaylistsModel::removedFromPlaylist(const QString &name, const QList<int> &
}
beginRemoveRows(parent, rowBegin-adjust, rowEnd-adjust);
for (int i=rowBegin; i<=rowEnd; ++i) {
pl->songs.removeAt(rowBegin-adjust);
delete pl->songs.takeAt(rowBegin-adjust);
adjust++;
}
endRemoveRows();