mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Artist id must be >0 when initializing it with pre-loaded data.
This commit is contained in:
@@ -43,6 +43,7 @@ QHash< unsigned int, artist_wptr > Artist::s_artistsById = QHash< unsigned int,
|
|||||||
static QMutex s_nameCacheMutex;
|
static QMutex s_nameCacheMutex;
|
||||||
static QReadWriteLock s_idMutex;
|
static QReadWriteLock s_idMutex;
|
||||||
|
|
||||||
|
|
||||||
Artist::~Artist()
|
Artist::~Artist()
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Deleting artist:" << m_name;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Deleting artist:" << m_name;
|
||||||
@@ -65,7 +66,7 @@ Artist::get( const QString& name, bool autoCreate )
|
|||||||
if ( s_artistsByName.contains( key ) )
|
if ( s_artistsByName.contains( key ) )
|
||||||
{
|
{
|
||||||
artist_wptr artist = s_artistsByName.value( key );
|
artist_wptr artist = s_artistsByName.value( key );
|
||||||
if ( !artist.isNull() )
|
if ( artist )
|
||||||
return artist.toStrongRef();
|
return artist.toStrongRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +85,8 @@ Artist::get( const QString& name, bool autoCreate )
|
|||||||
artist_ptr
|
artist_ptr
|
||||||
Artist::get( unsigned int id, const QString& name )
|
Artist::get( unsigned int id, const QString& name )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( id > 0 );
|
||||||
|
|
||||||
s_idMutex.lockForRead();
|
s_idMutex.lockForRead();
|
||||||
if ( s_artistsById.contains( id ) )
|
if ( s_artistsById.contains( id ) )
|
||||||
{
|
{
|
||||||
|
@@ -31,7 +31,6 @@
|
|||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
|
|
||||||
|
|
||||||
class IdThreadWorker;
|
class IdThreadWorker;
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
|
Reference in New Issue
Block a user