1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 09:34:53 +02:00

* Fixed shutdown freezes.

This commit is contained in:
Christian Muehlhaeuser
2011-05-29 11:14:20 +02:00
parent 5d03b35101
commit b5b8ba5a96
2 changed files with 16 additions and 46 deletions

View File

@@ -83,63 +83,32 @@ InfoSystem::InfoSystem(QObject *parent)
InfoSystem::~InfoSystem()
{
qDebug() << Q_FUNC_INFO << " beginning";
if ( !m_worker.isNull() )
{
QMetaObject::invokeMethod( m_worker.data(), "deleteLater", Qt::QueuedConnection );
while( !m_worker.isNull() )
{
qDebug() << Q_FUNC_INFO << " worker not deleted";
TomahawkUtils::Sleep::msleep( 50 );
}
if ( m_infoSystemWorkerThreadController )
m_infoSystemWorkerThreadController->quit();
if( m_infoSystemWorkerThreadController )
{
while( !m_infoSystemWorkerThreadController->isFinished() )
{
qDebug() << Q_FUNC_INFO << " worker thread controller not finished";
TomahawkUtils::Sleep::msleep( 50 );
}
qDebug() << Q_FUNC_INFO << " worker thread controller finished, deleting worker";
m_worker.clear();
m_infoSystemWorkerThreadController->quit();
m_infoSystemWorkerThreadController->wait( 60000 );
delete m_infoSystemWorkerThreadController;
qDebug() << Q_FUNC_INFO << " worker thread controller finished, deleting worker";
m_infoSystemWorkerThreadController = 0;
}
}
qDebug() << Q_FUNC_INFO << " done deleting worker";
if ( !m_cache.isNull() )
if( m_infoSystemCacheThreadController )
{
QMetaObject::invokeMethod( m_cache.data(), "deleteLater", Qt::QueuedConnection );
while( !m_cache.isNull() )
{
qDebug() << Q_FUNC_INFO << " cache not deleted";
TomahawkUtils::Sleep::msleep( 50 );
}
qDebug() << Q_FUNC_INFO << " cache deleted, telling cache thread controller to quit";
if ( m_infoSystemCacheThreadController )
m_infoSystemCacheThreadController->quit();
if( m_infoSystemCacheThreadController )
{
while( !m_infoSystemCacheThreadController->isFinished() )
{
qDebug() << Q_FUNC_INFO << " cache thread controller not finished";
TomahawkUtils::Sleep::msleep( 50 );
}
qDebug() << Q_FUNC_INFO << " cache thread controller finished, deleting cache";
delete m_infoSystemCacheThreadController;
m_infoSystemCacheThreadController = 0;
}
m_cache.clear();
m_infoSystemCacheThreadController->quit();
m_infoSystemCacheThreadController->wait( 60000 );
delete m_infoSystemCacheThreadController;
qDebug() << Q_FUNC_INFO << " cache thread controller finished, deleting cache";
m_infoSystemCacheThreadController = 0;
}
qDebug() << Q_FUNC_INFO << " done deleting cache, exiting";
}

View File

@@ -49,6 +49,7 @@ InfoSystemWorker::~InfoSystemWorker()
if( plugin )
delete plugin.data();
}
qDebug() << Q_FUNC_INFO << " finished";
}
@@ -169,7 +170,7 @@ InfoSystemWorker::nam() const
{
if ( m_nam.isNull() )
return 0;
return m_nam.data();
}
@@ -187,7 +188,7 @@ InfoSystemWorker::newNam()
emit namChanged( m_nam.data() );
return;
}
qDebug() << Q_FUNC_INFO << " no nam exists, or it's a different thread, creating a new one";
QNetworkAccessManager* newNam;
#ifdef LIBLASTFM_FOUND