mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-22 13:43:11 +02:00
Don't ask the infosystem for the same item data more than once racily
This commit is contained in:
@@ -78,6 +78,7 @@ Album::Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr&
|
||||
, m_name( name )
|
||||
, m_artist( artist )
|
||||
, m_infoLoaded( false )
|
||||
, m_infoLoading( false )
|
||||
#ifndef ENABLE_HEADLESS
|
||||
, m_cover( 0 )
|
||||
#endif
|
||||
@@ -107,7 +108,7 @@ Album::artist() const
|
||||
QPixmap
|
||||
Album::cover( const QSize& size, bool forceLoad ) const
|
||||
{
|
||||
if ( !m_infoLoaded )
|
||||
if ( !m_infoLoaded && !m_infoLoading )
|
||||
{
|
||||
if ( !forceLoad )
|
||||
return QPixmap();
|
||||
@@ -133,6 +134,8 @@ Album::cover( const QSize& size, bool forceLoad ) const
|
||||
SLOT( infoSystemFinished( QString ) ) );
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||
|
||||
m_infoLoading = true;
|
||||
}
|
||||
|
||||
if ( !m_cover && !m_coverBuffer.isEmpty() )
|
||||
|
@@ -76,6 +76,7 @@ private:
|
||||
artist_ptr m_artist;
|
||||
QByteArray m_coverBuffer;
|
||||
bool m_infoLoaded;
|
||||
mutable bool m_infoLoading;
|
||||
mutable QString m_uuid;
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
|
@@ -77,6 +77,7 @@ Artist::Artist( unsigned int id, const QString& name )
|
||||
, m_id( id )
|
||||
, m_name( name )
|
||||
, m_infoLoaded( false )
|
||||
, m_infoLoading( false )
|
||||
#ifndef ENABLE_HEADLESS
|
||||
, m_cover( 0 )
|
||||
#endif
|
||||
@@ -99,7 +100,7 @@ Artist::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
|
||||
QPixmap
|
||||
Artist::cover( const QSize& size, bool forceLoad ) const
|
||||
{
|
||||
if ( !m_infoLoaded )
|
||||
if ( !m_infoLoaded || !m_infoLoading )
|
||||
{
|
||||
if ( !forceLoad )
|
||||
return QPixmap();
|
||||
@@ -123,6 +124,8 @@ Artist::cover( const QSize& size, bool forceLoad ) const
|
||||
SLOT( infoSystemFinished( QString ) ) );
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||
|
||||
m_infoLoading = true;
|
||||
}
|
||||
|
||||
if ( !m_cover && !m_coverBuffer.isEmpty() )
|
||||
|
@@ -75,6 +75,7 @@ private:
|
||||
QString m_sortname;
|
||||
QByteArray m_coverBuffer;
|
||||
bool m_infoLoaded;
|
||||
mutable bool m_infoLoading;
|
||||
mutable QString m_uuid;
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
|
Reference in New Issue
Block a user