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

* Album's id needs to be initialized.

This commit is contained in:
Christian Muehlhaeuser
2013-05-16 11:15:06 +02:00
parent db5c7249b6
commit d6462dc002

View File

@@ -41,6 +41,7 @@ QHash< unsigned int, album_wptr > Album::s_albumsById = QHash< unsigned int, alb
static QMutex s_nameCacheMutex; static QMutex s_nameCacheMutex;
static QReadWriteLock s_idMutex; static QReadWriteLock s_idMutex;
Album::~Album() Album::~Album()
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Deleting album:" << m_name << m_artist->name(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Deleting album:" << m_name << m_artist->name();
@@ -70,7 +71,7 @@ Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCr
if ( s_albumsByName.contains( key ) ) if ( s_albumsByName.contains( key ) )
{ {
album_wptr album = s_albumsByName.value( key ); album_wptr album = s_albumsByName.value( key );
if ( !album.isNull() ) if ( album )
return album.toStrongRef(); return album.toStrongRef();
} }
@@ -92,7 +93,7 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
album_wptr album = s_albumsById.value( id ); album_wptr album = s_albumsById.value( id );
s_idMutex.unlock(); s_idMutex.unlock();
if ( !album.isNull() ) if ( album )
return album; return album;
} }
s_idMutex.unlock(); s_idMutex.unlock();
@@ -102,7 +103,7 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
if ( s_albumsByName.contains( key ) ) if ( s_albumsByName.contains( key ) )
{ {
album_wptr album = s_albumsByName.value( key ); album_wptr album = s_albumsByName.value( key );
if ( !album.isNull() ) if ( album )
return album; return album;
} }
@@ -141,6 +142,7 @@ Album::Album( unsigned int id, const QString& name, const Tomahawk::artist_ptr&
Album::Album( const QString& name, const Tomahawk::artist_ptr& artist ) Album::Album( const QString& name, const Tomahawk::artist_ptr& artist )
: QObject() : QObject()
, m_waitingForId( true ) , m_waitingForId( true )
, m_id( 0 )
, m_name( name ) , m_name( name )
, m_artist( artist ) , m_artist( artist )
, m_coverLoaded( false ) , m_coverLoaded( false )