Use std::shared_ptrfor AlbumCoverLoaderResult
Reduces memory fragmentation with Qt 6
This commit is contained in:
@@ -386,7 +386,9 @@ void Mpris2::CurrentSongChanged(const Song &song) {
|
||||
}
|
||||
|
||||
// ... and we add the cover information later, when it's available.
|
||||
void Mpris2::AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &result) {
|
||||
void Mpris2::AlbumCoverLoaded(const Song &song, AlbumCoverLoaderResultPtr result) {
|
||||
|
||||
if (!result) return;
|
||||
|
||||
last_metadata_ = QVariantMap();
|
||||
song.ToXesam(&last_metadata_);
|
||||
@@ -395,11 +397,11 @@ void Mpris2::AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &re
|
||||
AddMetadata("mpris:trackid", current_track_id(), &last_metadata_);
|
||||
|
||||
QUrl cover_url;
|
||||
if (result.album_cover.cover_url.isValid() && result.album_cover.cover_url.isLocalFile() && QFile(result.album_cover.cover_url.toLocalFile()).exists()) {
|
||||
cover_url = result.album_cover.cover_url;
|
||||
if (result->album_cover->cover_url.isValid() && result->album_cover->cover_url.isLocalFile() && QFile(result->album_cover->cover_url.toLocalFile()).exists()) {
|
||||
cover_url = result->album_cover->cover_url;
|
||||
}
|
||||
else if (result.temp_cover_url.isValid() && result.temp_cover_url.isLocalFile()) {
|
||||
cover_url = result.temp_cover_url;
|
||||
else if (result->temp_cover_url.isValid() && result->temp_cover_url.isLocalFile()) {
|
||||
cover_url = result->temp_cover_url;
|
||||
}
|
||||
else if (song.art_manual().isValid() && song.art_manual().isLocalFile() && song.art_manual().path() != Song::kManuallyUnsetCover && song.art_manual().path() != Song::kEmbeddedCover) {
|
||||
cover_url = song.art_manual();
|
||||
|
||||
Reference in New Issue
Block a user