1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Fix crash when accounts were loaded before attica was fetched

This commit is contained in:
Leo Franchi 2012-03-09 22:37:39 -05:00
parent 6dbcac58a4
commit 66e67fdd4e
2 changed files with 17 additions and 0 deletions
src/libtomahawk/accounts

@ -83,6 +83,13 @@ LastFmAccount::~LastFmAccount()
void
LastFmAccount::authenticate()
{
if ( !AtticaManager::instance()->resolversLoaded() )
{
// If we're still waiting to load, wait for the attica resolvers to come down the pipe
connect( AtticaManager::instance(), SIGNAL(resolversLoaded(Attica::Content::List)), this, SLOT( atticaLoaded( Attica::Content::List ) ), Qt::UniqueConnection );
return;
}
const Attica::Content res = AtticaManager::instance()->resolverForId( "lastfm" );
const AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( res );
@ -104,6 +111,14 @@ LastFmAccount::authenticate()
}
void
LastFmAccount::atticaLoaded( Attica::Content::List )
{
disconnect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( atticaLoaded( Attica::Content::List ) ) );
authenticate();
}
void
LastFmAccount::deauthenticate()
{

@ -94,6 +94,8 @@ public:
Attica::Content atticaContent() const;
private slots:
void atticaLoaded( Attica::Content::List );
void resolverInstalled( const QString& resolverId );
void resolverChanged();