1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02: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

View File

@@ -83,6 +83,13 @@ LastFmAccount::~LastFmAccount()
void void
LastFmAccount::authenticate() 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 Attica::Content res = AtticaManager::instance()->resolverForId( "lastfm" );
const AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( res ); 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 void
LastFmAccount::deauthenticate() LastFmAccount::deauthenticate()
{ {

View File

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