From b9606d8a065885f4ec93d9de0906a9291a233e24 Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Sun, 14 Oct 2012 23:27:45 +0200 Subject: [PATCH] Ignore GS search's result if it's not the last one --- src/internet/groovesharkservice.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/internet/groovesharkservice.cpp b/src/internet/groovesharkservice.cpp index 2d9321708..8e288d673 100644 --- a/src/internet/groovesharkservice.cpp +++ b/src/internet/groovesharkservice.cpp @@ -275,14 +275,17 @@ void GroovesharkService::DoSearch() { << Param("country", "") << Param("limit", QString::number(kSongSearchLimit)) << Param("offset", ""); - QNetworkReply* reply = CreateRequest("getSongSearchResults", parameters); - NewClosure(reply, SIGNAL(finished()), this, - SLOT(SearchSongsFinished(QNetworkReply*)), reply); + last_search_reply_ = CreateRequest("getSongSearchResults", parameters); + NewClosure(last_search_reply_, SIGNAL(finished()), this, + SLOT(SearchSongsFinished(QNetworkReply*)), last_search_reply_); } void GroovesharkService::SearchSongsFinished(QNetworkReply* reply) { reply->deleteLater(); + if (reply != last_search_reply_) + return; + QVariantMap result = ExtractResult(reply); SongList songs = ExtractSongs(result); app_->task_manager()->SetTaskFinished(task_search_id_);