1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

Hopefully fix startup crash in single-threaded infosystemworker mode

This commit is contained in:
Jeff Mitchell
2011-05-03 12:36:23 -04:00
parent 99563bfde6
commit 44173808cb
2 changed files with 9 additions and 4 deletions

View File

@@ -62,7 +62,7 @@ InfoSystem::InfoSystem(QObject *parent)
m_infoSystemWorkerThreadController = new QThread( this ); m_infoSystemWorkerThreadController = new QThread( this );
m_worker = new InfoSystemWorker(); m_worker = new InfoSystemWorker();
m_worker->moveToThread( m_infoSystemWorkerThreadController ); //m_worker->moveToThread( m_infoSystemWorkerThreadController );
m_infoSystemWorkerThreadController->start(); m_infoSystemWorkerThreadController->start();
QMetaObject::invokeMethod( m_worker, "init", Qt::QueuedConnection ); QMetaObject::invokeMethod( m_worker, "init", Qt::QueuedConnection );

View File

@@ -169,6 +169,13 @@ InfoSystemWorker::newNam()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QNetworkAccessManager *oldNam = TomahawkUtils::nam();
if ( oldNam && m_nam == oldNam )
{
emit namChanged();
return;
}
QNetworkAccessManager* newNam; QNetworkAccessManager* newNam;
#ifdef LIBLASTFM_FOUND #ifdef LIBLASTFM_FOUND
newNam = new lastfm::NetworkAccessManager( this ); newNam = new lastfm::NetworkAccessManager( this );
@@ -176,10 +183,8 @@ InfoSystemWorker::newNam()
newNam = new QNetworkAccessManager( this ); newNam = new QNetworkAccessManager( this );
#endif #endif
if ( m_nam ) if ( m_nam )
{
delete m_nam; delete m_nam;
}
QNetworkAccessManager *oldNam = TomahawkUtils::nam();
if ( !oldNam ) if ( !oldNam )
{ {
m_nam = newNam; m_nam = newNam;