Skip to content

Commit

Permalink
* Fixed InfoSystem DTOR freezing.
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed May 29, 2011
1 parent c24e90c commit 635c490
Showing 1 changed file with 13 additions and 44 deletions.
57 changes: 13 additions & 44 deletions src/libtomahawk/infosystem/infosystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,59 +83,28 @@ 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, processing events";
TomahawkUtils::Sleep::msleep( 50 );
}

if ( m_infoSystemWorkerThreadController )
m_infoSystemWorkerThreadController->quit();
m_worker.clear();
m_infoSystemWorkerThreadController->quit();
m_infoSystemWorkerThreadController->wait( 60000 );

if( m_infoSystemWorkerThreadController )
{
while( !m_infoSystemWorkerThreadController->isFinished() )
{
qDebug() << Q_FUNC_INFO << " worker thread controller not finished, processing events";
TomahawkUtils::Sleep::msleep( 50 );
}

delete m_infoSystemWorkerThreadController;
m_infoSystemWorkerThreadController = 0;
}
delete m_infoSystemWorkerThreadController;
m_infoSystemWorkerThreadController = 0;
}

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 << " worker not deleted, processing events";
TomahawkUtils::Sleep::msleep( 50 );
}

if ( m_infoSystemCacheThreadController )
m_infoSystemCacheThreadController->quit();

if( m_infoSystemCacheThreadController )
{
while( !m_infoSystemCacheThreadController->isFinished() )
{
qDebug() << Q_FUNC_INFO << " worker thread controller not finished, processing events";
TomahawkUtils::Sleep::msleep( 50 );
}

delete m_infoSystemCacheThreadController;
m_infoSystemCacheThreadController = 0;
}
m_cache.clear();
m_infoSystemCacheThreadController->quit();
m_infoSystemCacheThreadController->wait( 60000 );

delete m_infoSystemCacheThreadController;
m_infoSystemCacheThreadController = 0;
}

qDebug() << Q_FUNC_INFO << " done deleting cache";
}

Expand Down

0 comments on commit 635c490

Please sign in to comment.