diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-10-23 20:02:36 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-10-23 20:02:36 -0500 |
commit | 69eb063fbda7355896da9694d9cc37669c2efad9 (patch) | |
tree | 96c3ca32636b380b249138c3359cf9cedab7172d | |
parent | 90583bbb71f15a22a1ff29c47a406607d52a407f (diff) | |
download | amarok-69eb063fbda7355896da9694d9cc37669c2efad9.tar.gz amarok-69eb063fbda7355896da9694d9cc37669c2efad9.zip |
Fix crash on scrobbling due to scrobbler methods being called from a thread other than the scrobbler owning thread
This resolves Bug 1675
-rw-r--r-- | amarok/src/collectiondb.cpp | 9 | ||||
-rw-r--r-- | amarok/src/collectiondb.h | 3 | ||||
-rw-r--r-- | amarok/src/scrobbler.h | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/amarok/src/collectiondb.cpp b/amarok/src/collectiondb.cpp index 29db57eb..e618ae60 100644 --- a/amarok/src/collectiondb.cpp +++ b/amarok/src/collectiondb.cpp @@ -224,8 +224,8 @@ CollectionDB::CollectionDB() , m_aftEnabledPersistentTables() , m_moveFileJobCancelled( false ) { - // We have our own thread manager - disableThreadPostedEvents(true); + // Enable cross thread requests for scrobbler + connect(this, SIGNAL(startScrobblerSimilarArtistsFetch(const TQString &)), Scrobbler::instance(), SLOT(similarArtists(const TQString &))); DEBUG_BLOCK @@ -4364,8 +4364,9 @@ CollectionDB::similarArtists( const TQString &artist, uint count ) values = query( TQString( "SELECT suggestion FROM related_artists WHERE artist = '%1' ORDER BY %2 LIMIT %3 OFFSET 0;" ) .arg( escapeString( artist ), randomFunc(), TQString::number( count ) ) ); - if ( values.isEmpty() ) - Scrobbler::instance()->similarArtists( artist ); + if ( values.isEmpty() ) { + startScrobblerSimilarArtistsFetch( artist ); + } return values; } diff --git a/amarok/src/collectiondb.h b/amarok/src/collectiondb.h index 8244ed77..b9a42d53 100644 --- a/amarok/src/collectiondb.h +++ b/amarok/src/collectiondb.h @@ -227,6 +227,9 @@ class LIBAMAROK_EXPORT CollectionDB : public TQObject, public EngineObserver void tagsChanged( const TQString &oldArtist, const TQString &oldAlbum ); void imageFetched( const TQString &remoteURL ); //for fetching remote podcast images + // Cross-thread communication + void startScrobblerSimilarArtistsFetch(const TQString &); + public: CollectionDB(); ~CollectionDB(); diff --git a/amarok/src/scrobbler.h b/amarok/src/scrobbler.h index eaa038b7..5fb8e140 100644 --- a/amarok/src/scrobbler.h +++ b/amarok/src/scrobbler.h @@ -34,7 +34,6 @@ class Scrobbler : public TQObject, public EngineObserver public: static Scrobbler *instance(); - void similarArtists( const TQString & /*artist*/ ); void applySettings(); signals: @@ -42,6 +41,7 @@ class Scrobbler : public TQObject, public EngineObserver public slots: void subTrack( long currentPos, long startPos, long endPos ); // cuefiles can update length without track change + void similarArtists( const TQString & /*artist*/ ); protected: Scrobbler(); |