mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Try to avoid race conditions
This commit is contained in:
@@ -123,13 +123,7 @@ EchonestGenerator::EchonestGenerator ( QObject* parent )
|
|||||||
|
|
||||||
loadStylesAndMoods();
|
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() ) );
|
connect( s_catalogs, SIGNAL( catalogsUpdated() ), this, SLOT( knownCatalogsChanged() ) );
|
||||||
// qDebug() << "ECHONEST:" << m_logo.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,6 +132,15 @@ EchonestGenerator::~EchonestGenerator()
|
|||||||
delete m_dynPlaylist;
|
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
|
dyncontrol_ptr
|
||||||
EchonestGenerator::createControl( const QString& type )
|
EchonestGenerator::createControl( const QString& type )
|
||||||
|
@@ -84,6 +84,7 @@ public:
|
|||||||
static QStringList userCatalogs();
|
static QStringList userCatalogs();
|
||||||
static QByteArray catalogId( const QString& collectionId );
|
static QByteArray catalogId( const QString& collectionId );
|
||||||
|
|
||||||
|
static void setupCatalogs();
|
||||||
signals:
|
signals:
|
||||||
void paramsGenerated( const Echonest::DynamicPlaylist::PlaylistParams& );
|
void paramsGenerated( const Echonest::DynamicPlaylist::PlaylistParams& );
|
||||||
|
|
||||||
|
@@ -181,7 +181,7 @@ TomahawkApp::init()
|
|||||||
new Pipeline( this );
|
new Pipeline( this );
|
||||||
|
|
||||||
m_servent = QWeakPointer<Servent>( new Servent( 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.";
|
tDebug() << "Init Database.";
|
||||||
initDatabase();
|
initDatabase();
|
||||||
@@ -500,6 +500,13 @@ TomahawkApp::initServent()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkApp::serventReady()
|
||||||
|
{
|
||||||
|
EchonestGenerator::setupCatalogs();
|
||||||
|
|
||||||
|
initSIP();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkApp::initSIP()
|
TomahawkApp::initSIP()
|
||||||
|
@@ -95,10 +95,12 @@ public slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initServent();
|
void initServent();
|
||||||
void initSIP();
|
void serventReady();
|
||||||
|
|
||||||
void spotifyApiCheckFinished();
|
void spotifyApiCheckFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initSIP();
|
||||||
void registerMetaTypes();
|
void registerMetaTypes();
|
||||||
|
|
||||||
void printHelp();
|
void printHelp();
|
||||||
|
Reference in New Issue
Block a user