Fix crash on scrobbling due to scrobbler methods being called from a thread other than the scrobbler owning thread

This resolves Bug 1675
pull/1/head
Timothy Pearson 9 years ago
parent 90583bbb71
commit 69eb063fbd
  1. 9
      amarok/src/collectiondb.cpp
  2. 3
      amarok/src/collectiondb.h
  3. 2
      amarok/src/scrobbler.h

@ -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;
}

@ -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();

@ -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();

Loading…
Cancel
Save