1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-26 15:25:04 +02:00

Banish ghost accounts from lingering around.

This commit is contained in:
Teo Mrnjavac
2012-08-15 22:39:36 +02:00
parent 7ca808a676
commit 6047a85f40

View File

@@ -123,6 +123,18 @@ AccountListWidget::removeEntries( const QModelIndex& parent, int start, int end
for ( int i = start; i <= end; ++i ) for ( int i = start; i <= end; ++i )
{ {
QPersistentModelIndex idx( m_model->index( i, 0, parent ) ); QPersistentModelIndex idx( m_model->index( i, 0, parent ) );
if ( !idx.isValid() ) //means we just removed the last account for a factory
{
for ( QHash< QPersistentModelIndex, QList< AccountWidget* > >::iterator it = m_entries.begin();
it != m_entries.end(); ++it )
{
if ( !it.key().isValid() )
{
idx = it.key();
}
}
}
QList< AccountWidget* > &entryAccounts = m_entries[ idx ]; QList< AccountWidget* > &entryAccounts = m_entries[ idx ];
for ( int j = 0; j < entryAccounts.count(); ++j ) for ( int j = 0; j < entryAccounts.count(); ++j )
{ {