diff --git a/src/libtomahawk/pipeline.cpp b/src/libtomahawk/pipeline.cpp index d6f3e8891..b14bddb16 100644 --- a/src/libtomahawk/pipeline.cpp +++ b/src/libtomahawk/pipeline.cpp @@ -220,7 +220,8 @@ Pipeline::shuntNext() if ( m_queries_pending.isEmpty() ) { - emit idle(); + if ( m_qidsState.isEmpty() ) + emit idle(); return; } diff --git a/src/libtomahawk/playlist/playlistmodel.cpp b/src/libtomahawk/playlist/playlistmodel.cpp index 210cabf2c..e55e0148a 100644 --- a/src/libtomahawk/playlist/playlistmodel.cpp +++ b/src/libtomahawk/playlist/playlistmodel.cpp @@ -75,10 +75,7 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn if ( rowCount( QModelIndex() ) && loadEntries ) { - emit beginResetModel(); - delete m_rootItem; - emit endResetModel(); - m_rootItem = new PlItem( 0, this ); + clear(); } m_playlist = playlist; @@ -125,10 +122,7 @@ PlaylistModel::loadHistory( const Tomahawk::source_ptr& source, unsigned int amo { if ( rowCount( QModelIndex() ) ) { - emit beginRemoveRows( QModelIndex(), 0, rowCount( QModelIndex() ) - 1 ); - delete m_rootItem; - emit endRemoveRows(); - m_rootItem = new PlItem( 0, this ); + clear(); } m_playlist.clear(); @@ -149,9 +143,9 @@ PlaylistModel::clear() { if ( rowCount( QModelIndex() ) ) { - emit beginRemoveRows( QModelIndex(), 0, rowCount( QModelIndex() ) - 1 ); + emit beginResetModel(); delete m_rootItem; - emit endRemoveRows(); + emit endResetModel(); m_rootItem = new PlItem( 0, this ); } }