mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-18 20:40:43 +01:00
Fix a crash and a never-ending task when expanding the Grooveshark item for the first time with an invalid or expired session.
This commit is contained in:
parent
eeb617e892
commit
150d5a124a
@ -716,6 +716,11 @@ void GroovesharkService::RetrieveUserFavorites() {
|
||||
void GroovesharkService::UserFavoritesRetrieved(QNetworkReply* reply, int task_id) {
|
||||
reply->deleteLater();
|
||||
|
||||
if (!favorites_) {
|
||||
// The use probably logged out before the response arrived.
|
||||
return;
|
||||
}
|
||||
|
||||
favorites_->removeRows(0, favorites_->rowCount());
|
||||
|
||||
QVariantMap result = ExtractResult(reply);
|
||||
@ -752,8 +757,15 @@ void GroovesharkService::PopularSongsMonthRetrieved(QNetworkReply* reply) {
|
||||
reply->deleteLater();
|
||||
QVariantMap result = ExtractResult(reply);
|
||||
SongList songs = ExtractSongs(result);
|
||||
|
||||
app_->task_manager()->IncreaseTaskProgress(task_popular_id_, 50, 100);
|
||||
if (app_->task_manager()->GetTaskProgress(task_popular_id_) >= 100) {
|
||||
app_->task_manager()->SetTaskFinished(task_popular_id_);
|
||||
}
|
||||
|
||||
if (!popular_month_)
|
||||
return;
|
||||
|
||||
foreach (const Song& song, songs) {
|
||||
QStandardItem* child = new QStandardItem(song.PrettyTitleWithArtist());
|
||||
child->setData(Type_Track, InternetModel::Role_Type);
|
||||
@ -763,11 +775,6 @@ void GroovesharkService::PopularSongsMonthRetrieved(QNetworkReply* reply) {
|
||||
|
||||
popular_month_->appendRow(child);
|
||||
}
|
||||
|
||||
app_->task_manager()->IncreaseTaskProgress(task_popular_id_, 50, 100);
|
||||
if (app_->task_manager()->GetTaskProgress(task_popular_id_) >= 100) {
|
||||
app_->task_manager()->SetTaskFinished(task_popular_id_);
|
||||
}
|
||||
}
|
||||
|
||||
void GroovesharkService::RetrievePopularSongsToday() {
|
||||
@ -782,8 +789,15 @@ void GroovesharkService::PopularSongsTodayRetrieved(QNetworkReply* reply) {
|
||||
reply->deleteLater();
|
||||
QVariantMap result = ExtractResult(reply);
|
||||
SongList songs = ExtractSongs(result);
|
||||
|
||||
app_->task_manager()->IncreaseTaskProgress(task_popular_id_, 50, 100);
|
||||
if (app_->task_manager()->GetTaskProgress(task_popular_id_) >= 100) {
|
||||
app_->task_manager()->SetTaskFinished(task_popular_id_);
|
||||
}
|
||||
|
||||
if (!popular_today_)
|
||||
return;
|
||||
|
||||
foreach (const Song& song, songs) {
|
||||
QStandardItem* child = new QStandardItem(song.PrettyTitleWithArtist());
|
||||
child->setData(Type_Track, InternetModel::Role_Type);
|
||||
@ -793,11 +807,6 @@ void GroovesharkService::PopularSongsTodayRetrieved(QNetworkReply* reply) {
|
||||
|
||||
popular_today_->appendRow(child);
|
||||
}
|
||||
|
||||
app_->task_manager()->IncreaseTaskProgress(task_popular_id_, 50, 100);
|
||||
if (app_->task_manager()->GetTaskProgress(task_popular_id_) >= 100) {
|
||||
app_->task_manager()->SetTaskFinished(task_popular_id_);
|
||||
}
|
||||
}
|
||||
|
||||
void GroovesharkService::RetrieveSubscribedPlaylists() {
|
||||
|
Loading…
Reference in New Issue
Block a user