Use deleteLater() for Subsonic, Tidal and QObuz requests

This commit is contained in:
Jonas Kvinge
2022-02-06 00:58:50 +01:00
parent 1dd4eb05f2
commit 192fb46d1d
5 changed files with 47 additions and 27 deletions

View File

@@ -399,7 +399,7 @@ void SubsonicService::Scrobble(const QString &song_id, const bool submission, co
if (!scrobble_request_) {
// We're doing requests every 30-240s the whole time, so keep reusing this instance
scrobble_request_ = std::make_shared<SubsonicScrobbleRequest>(this, url_handler_, app_);
scrobble_request_.reset(new SubsonicScrobbleRequest(this, url_handler_, app_), [](SubsonicScrobbleRequest *request) { request->deleteLater(); });
}
scrobble_request_->CreateScrobbleRequest(song_id, submission, time);
@@ -429,7 +429,7 @@ void SubsonicService::GetSongs() {
}
ResetSongsRequest();
songs_request_ = std::make_shared<SubsonicRequest>(this, url_handler_, app_);
songs_request_.reset(new SubsonicRequest(this, url_handler_, app_), [](SubsonicRequest *request) { request->deleteLater(); });
QObject::connect(songs_request_.get(), &SubsonicRequest::Results, this, &SubsonicService::SongsResultsReceived);
QObject::connect(songs_request_.get(), &SubsonicRequest::UpdateStatus, this, &SubsonicService::SongsUpdateStatus);
QObject::connect(songs_request_.get(), &SubsonicRequest::ProgressSetMaximum, this, &SubsonicService::SongsProgressSetMaximum);
@@ -449,6 +449,8 @@ void SubsonicService::SongsResultsReceived(const SongMap &songs, const QString &
emit SongsResults(songs, error);
ResetSongsRequest();
}
void SubsonicService::PingError(const QString &error, const QVariant &debug) {