mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-17 06:18:17 +01:00
Protect m_formats access with mutex in Result
This commit is contained in:
parent
e7d83835d2
commit
cb3ccd5a76
@ -529,12 +529,23 @@ Result::track() const
|
||||
}
|
||||
|
||||
|
||||
QList< DownloadFormat >
|
||||
Result::downloadFormats() const
|
||||
{
|
||||
QMutexLocker lock( &s_mutex );
|
||||
|
||||
return m_formats;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Result::setDownloadFormats( const QList<DownloadFormat>& formats )
|
||||
{
|
||||
if ( formats.isEmpty() )
|
||||
return;
|
||||
|
||||
QMutexLocker lock( &s_mutex );
|
||||
|
||||
m_formats.clear();
|
||||
foreach ( const DownloadFormat& format, formats )
|
||||
{
|
||||
@ -562,7 +573,7 @@ Result::setDownloadFormats( const QList<DownloadFormat>& formats )
|
||||
void
|
||||
Result::onSettingsChanged()
|
||||
{
|
||||
if ( TomahawkSettings::instance()->downloadsPreferredFormat().toLower() != m_formats.first().extension.toLower() )
|
||||
if ( TomahawkSettings::instance()->downloadsPreferredFormat().toLower() != downloadFormats().first().extension.toLower() )
|
||||
{
|
||||
setDownloadFormats( downloadFormats() );
|
||||
emit updated();
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
|
||||
track_ptr track() const;
|
||||
|
||||
QList<DownloadFormat> downloadFormats() const { return m_formats; }
|
||||
QList< DownloadFormat > downloadFormats() const;
|
||||
void setDownloadFormats( const QList<DownloadFormat>& formats );
|
||||
|
||||
downloadjob_ptr downloadJob() const { return m_downloadJob; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user