mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
Try to avoid race conditions
This commit is contained in:
parent
658deb3bcd
commit
0736a65f2a
@ -123,13 +123,7 @@ EchonestGenerator::EchonestGenerator ( QObject* parent )
|
||||
|
||||
loadStylesAndMoods();
|
||||
|
||||
// TODO Yes this is a race condition. If multiple threads initialize echonestgenerator at the exact same time we could run into some issues.
|
||||
// not dealing with that right now.
|
||||
if ( s_catalogs == 0 )
|
||||
s_catalogs = new CatalogManager( this );
|
||||
|
||||
connect( s_catalogs, SIGNAL( catalogsUpdated() ), this, SLOT( knownCatalogsChanged() ) );
|
||||
// qDebug() << "ECHONEST:" << m_logo.size();
|
||||
}
|
||||
|
||||
|
||||
@ -138,6 +132,15 @@ EchonestGenerator::~EchonestGenerator()
|
||||
delete m_dynPlaylist;
|
||||
}
|
||||
|
||||
void
|
||||
EchonestGenerator::setupCatalogs()
|
||||
{
|
||||
// TODO Yes this is a race condition. If multiple threads initialize echonestgenerator at the exact same time we could run into some issues.
|
||||
// not dealing with that right now.
|
||||
if ( s_catalogs == 0 )
|
||||
s_catalogs = new CatalogManager( 0 );
|
||||
// qDebug() << "ECHONEST:" << m_logo.size();
|
||||
}
|
||||
|
||||
dyncontrol_ptr
|
||||
EchonestGenerator::createControl( const QString& type )
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
static QStringList userCatalogs();
|
||||
static QByteArray catalogId( const QString& collectionId );
|
||||
|
||||
static void setupCatalogs();
|
||||
signals:
|
||||
void paramsGenerated( const Echonest::DynamicPlaylist::PlaylistParams& );
|
||||
|
||||
|
@ -181,7 +181,7 @@ TomahawkApp::init()
|
||||
new Pipeline( this );
|
||||
|
||||
m_servent = QWeakPointer<Servent>( new Servent( this ) );
|
||||
connect( m_servent.data(), SIGNAL( ready() ), SLOT( initSIP() ) );
|
||||
connect( m_servent.data(), SIGNAL( ready() ), SLOT( serventReady() ) );
|
||||
|
||||
tDebug() << "Init Database.";
|
||||
initDatabase();
|
||||
@ -500,6 +500,13 @@ TomahawkApp::initServent()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkApp::serventReady()
|
||||
{
|
||||
EchonestGenerator::setupCatalogs();
|
||||
|
||||
initSIP();
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkApp::initSIP()
|
||||
|
@ -95,10 +95,12 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void initServent();
|
||||
void initSIP();
|
||||
void serventReady();
|
||||
|
||||
void spotifyApiCheckFinished();
|
||||
|
||||
private:
|
||||
void initSIP();
|
||||
void registerMetaTypes();
|
||||
|
||||
void printHelp();
|
||||
|
Loading…
x
Reference in New Issue
Block a user