1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-15 10:33:59 +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

@@ -86,59 +86,28 @@ InfoSystem::~InfoSystem()
if ( !m_worker.isNull() ) 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 ) if( m_infoSystemWorkerThreadController )
{ {
while( !m_infoSystemWorkerThreadController->isFinished() ) m_worker.clear();
{ m_infoSystemWorkerThreadController->quit();
qDebug() << Q_FUNC_INFO << " worker thread controller not finished"; m_infoSystemWorkerThreadController->wait( 60000 );
TomahawkUtils::Sleep::msleep( 50 );
}
qDebug() << Q_FUNC_INFO << " worker thread controller finished, deleting worker";
delete m_infoSystemWorkerThreadController; delete m_infoSystemWorkerThreadController;
qDebug() << Q_FUNC_INFO << " worker thread controller finished, deleting worker";
m_infoSystemWorkerThreadController = 0; m_infoSystemWorkerThreadController = 0;
} }
} }
qDebug() << Q_FUNC_INFO << " done deleting worker"; qDebug() << Q_FUNC_INFO << " done deleting worker";
if ( !m_cache.isNull() )
{
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 ) if( m_infoSystemCacheThreadController )
{ {
while( !m_infoSystemCacheThreadController->isFinished() ) m_cache.clear();
{ m_infoSystemCacheThreadController->quit();
qDebug() << Q_FUNC_INFO << " cache thread controller not finished"; m_infoSystemCacheThreadController->wait( 60000 );
TomahawkUtils::Sleep::msleep( 50 );
}
qDebug() << Q_FUNC_INFO << " cache thread controller finished, deleting cache";
delete m_infoSystemCacheThreadController; delete m_infoSystemCacheThreadController;
qDebug() << Q_FUNC_INFO << " cache thread controller finished, deleting cache";
m_infoSystemCacheThreadController = 0; m_infoSystemCacheThreadController = 0;
} }
}
qDebug() << Q_FUNC_INFO << " done deleting cache, exiting"; qDebug() << Q_FUNC_INFO << " done deleting cache, exiting";
} }

View File

@@ -49,6 +49,7 @@ InfoSystemWorker::~InfoSystemWorker()
if( plugin ) if( plugin )
delete plugin.data(); delete plugin.data();
} }
qDebug() << Q_FUNC_INFO << " finished";
} }