mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-22 21:54:00 +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_name( name )
|
||||||
, m_artist( artist )
|
, m_artist( artist )
|
||||||
, m_infoLoaded( false )
|
, m_infoLoaded( false )
|
||||||
|
, m_infoLoading( false )
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
, m_cover( 0 )
|
, m_cover( 0 )
|
||||||
#endif
|
#endif
|
||||||
@@ -107,7 +108,7 @@ Album::artist() const
|
|||||||
QPixmap
|
QPixmap
|
||||||
Album::cover( const QSize& size, bool forceLoad ) const
|
Album::cover( const QSize& size, bool forceLoad ) const
|
||||||
{
|
{
|
||||||
if ( !m_infoLoaded )
|
if ( !m_infoLoaded && !m_infoLoading )
|
||||||
{
|
{
|
||||||
if ( !forceLoad )
|
if ( !forceLoad )
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
@@ -133,6 +134,8 @@ Album::cover( const QSize& size, bool forceLoad ) const
|
|||||||
SLOT( infoSystemFinished( QString ) ) );
|
SLOT( infoSystemFinished( QString ) ) );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||||
|
|
||||||
|
m_infoLoading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_cover && !m_coverBuffer.isEmpty() )
|
if ( !m_cover && !m_coverBuffer.isEmpty() )
|
||||||
|
@@ -76,6 +76,7 @@ private:
|
|||||||
artist_ptr m_artist;
|
artist_ptr m_artist;
|
||||||
QByteArray m_coverBuffer;
|
QByteArray m_coverBuffer;
|
||||||
bool m_infoLoaded;
|
bool m_infoLoaded;
|
||||||
|
mutable bool m_infoLoading;
|
||||||
mutable QString m_uuid;
|
mutable QString m_uuid;
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
|
@@ -77,6 +77,7 @@ Artist::Artist( unsigned int id, const QString& name )
|
|||||||
, m_id( id )
|
, m_id( id )
|
||||||
, m_name( name )
|
, m_name( name )
|
||||||
, m_infoLoaded( false )
|
, m_infoLoaded( false )
|
||||||
|
, m_infoLoading( false )
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
, m_cover( 0 )
|
, m_cover( 0 )
|
||||||
#endif
|
#endif
|
||||||
@@ -99,7 +100,7 @@ Artist::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
|
|||||||
QPixmap
|
QPixmap
|
||||||
Artist::cover( const QSize& size, bool forceLoad ) const
|
Artist::cover( const QSize& size, bool forceLoad ) const
|
||||||
{
|
{
|
||||||
if ( !m_infoLoaded )
|
if ( !m_infoLoaded || !m_infoLoading )
|
||||||
{
|
{
|
||||||
if ( !forceLoad )
|
if ( !forceLoad )
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
@@ -123,6 +124,8 @@ Artist::cover( const QSize& size, bool forceLoad ) const
|
|||||||
SLOT( infoSystemFinished( QString ) ) );
|
SLOT( infoSystemFinished( QString ) ) );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||||
|
|
||||||
|
m_infoLoading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_cover && !m_coverBuffer.isEmpty() )
|
if ( !m_cover && !m_coverBuffer.isEmpty() )
|
||||||
|
@@ -75,6 +75,7 @@ private:
|
|||||||
QString m_sortname;
|
QString m_sortname;
|
||||||
QByteArray m_coverBuffer;
|
QByteArray m_coverBuffer;
|
||||||
bool m_infoLoaded;
|
bool m_infoLoaded;
|
||||||
|
mutable bool m_infoLoading;
|
||||||
mutable QString m_uuid;
|
mutable QString m_uuid;
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
|
Reference in New Issue
Block a user