Ignore GS search's result if it's not the last one
This commit is contained in:
parent
8eb787a2eb
commit
b9606d8a06
|
@ -275,14 +275,17 @@ void GroovesharkService::DoSearch() {
|
||||||
<< Param("country", "")
|
<< Param("country", "")
|
||||||
<< Param("limit", QString::number(kSongSearchLimit))
|
<< Param("limit", QString::number(kSongSearchLimit))
|
||||||
<< Param("offset", "");
|
<< Param("offset", "");
|
||||||
QNetworkReply* reply = CreateRequest("getSongSearchResults", parameters);
|
last_search_reply_ = CreateRequest("getSongSearchResults", parameters);
|
||||||
NewClosure(reply, SIGNAL(finished()), this,
|
NewClosure(last_search_reply_, SIGNAL(finished()), this,
|
||||||
SLOT(SearchSongsFinished(QNetworkReply*)), reply);
|
SLOT(SearchSongsFinished(QNetworkReply*)), last_search_reply_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroovesharkService::SearchSongsFinished(QNetworkReply* reply) {
|
void GroovesharkService::SearchSongsFinished(QNetworkReply* reply) {
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
|
if (reply != last_search_reply_)
|
||||||
|
return;
|
||||||
|
|
||||||
QVariantMap result = ExtractResult(reply);
|
QVariantMap result = ExtractResult(reply);
|
||||||
SongList songs = ExtractSongs(result);
|
SongList songs = ExtractSongs(result);
|
||||||
app_->task_manager()->SetTaskFinished(task_search_id_);
|
app_->task_manager()->SetTaskFinished(task_search_id_);
|
||||||
|
|
Loading…
Reference in New Issue