diff --git a/src/libtomahawk/Album.cpp b/src/libtomahawk/Album.cpp index 89b46eef5..c2a9bac87 100644 --- a/src/libtomahawk/Album.cpp +++ b/src/libtomahawk/Album.cpp @@ -201,9 +201,12 @@ Album::id() const m_waitingForId = false; if ( m_id > 0 ) + { + QMutexLocker lock( &s_mutex ); s_albumsById[ m_id ] = m_ownRef.toStrongRef(); - s_idMutex.unlock(); + } + s_idMutex.unlock(); } return finalId; diff --git a/src/libtomahawk/Artist.cpp b/src/libtomahawk/Artist.cpp index 03deda53e..29c279ffe 100644 --- a/src/libtomahawk/Artist.cpp +++ b/src/libtomahawk/Artist.cpp @@ -280,7 +280,11 @@ Artist::id() const m_waitingForFuture = false; if ( m_id > 0 ) + { + QMutexLocker lock( &s_mutex ); s_artistsById[ m_id ] = m_ownRef.toStrongRef(); + } + s_idMutex.unlock(); }