From 6726c7fcf06b7e210f68669c09cc62c60ca1df78 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 14 Jul 2012 14:02:59 +0200 Subject: [PATCH] * Lock mutex when adding to the static hashes in Artist and Album. --- src/libtomahawk/Album.cpp | 3 +++ src/libtomahawk/Artist.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/libtomahawk/Album.cpp b/src/libtomahawk/Album.cpp index 07487230e..cd7661897 100644 --- a/src/libtomahawk/Album.cpp +++ b/src/libtomahawk/Album.cpp @@ -214,7 +214,10 @@ Album::id() const m_waitingForId = false; if ( m_id > 0 ) + { + QMutexLocker lock( &s_mutex ); s_albumsById[ m_id ] = m_ownRef.toStrongRef(); + } s_idMutex.unlock(); } diff --git a/src/libtomahawk/Artist.cpp b/src/libtomahawk/Artist.cpp index 88b45ab2b..d8cd6393f 100644 --- a/src/libtomahawk/Artist.cpp +++ b/src/libtomahawk/Artist.cpp @@ -306,7 +306,10 @@ Artist::id() const m_waitingForFuture = false; if ( m_id > 0 ) + { + QMutexLocker lock( &s_mutex ); s_artistsById[ m_id ] = m_ownRef.toStrongRef(); + } s_idMutex.unlock(); }