diff --git a/src/tagreader/tagreaderclient.cpp b/src/tagreader/tagreaderclient.cpp index 45a25a6151..04799da9c6 100644 --- a/src/tagreader/tagreaderclient.cpp +++ b/src/tagreader/tagreaderclient.cpp @@ -384,7 +384,11 @@ void TagReaderClient::SaveSongsPlaycountAsync(const SongList &songs) { Q_ASSERT(QThread::currentThread() != thread()); for (const Song &song : songs) { - SaveSongPlaycountAsync(song.url().toLocalFile(), song.playcount()); + SharedPtr connection = make_shared(); + TagReaderReplyPtr reply = SaveSongPlaycountAsync(song.url().toLocalFile(), song.playcount()); + *connection = QObject::connect(&*reply, &TagReaderReply::Finished, this, [reply, connection]() { + QObject::disconnect(*connection); + }, Qt::QueuedConnection); } } @@ -417,7 +421,11 @@ void TagReaderClient::SaveSongsRatingAsync(const SongList &songs) { Q_ASSERT(QThread::currentThread() != thread()); for (const Song &song : songs) { - SaveSongRatingAsync(song.url().toLocalFile(), song.rating()); + SharedPtr connection = make_shared(); + TagReaderReplyPtr reply = SaveSongRatingAsync(song.url().toLocalFile(), song.rating()); + *connection = QObject::connect(&*reply, &TagReaderReply::Finished, this, [reply, connection]() { + QObject::disconnect(*connection); + }, Qt::QueuedConnection); } }