@@ -168,22 +168,22 @@ std::string AlbumArtProvider::get_image(const std::string &artist, const std::st
168168 return DEFAULT_ALBUM_ART;
169169 }
170170 fix_format(tmpname.c_str());
171− FILE *f = fopen(tmpname.c_str(), "r");
172− fseek(f, 0, SEEK_END);
173− long s = ftell(f);
174− fseek(f, 0, SEEK_SET);
175− char *buf = new char[s];
176− fread(buf, 1, s, f);
177− fclose(f);
171+ QFile f(fname);
172+ if(!f.open(QIODevice::ReadWrite)) {
173+ return DEFAULT_ALBUM_ART;
174+ }
175+ QByteArray arr = f.readAll();
176+ f.close();
178177
178+ cache.add_art(info.artist, info.album, arr.data(), arr.size());
179179 try {
180− cache.add_art(info.artist, info.album, buf, s);
180+ std::string res = cache.get_art_file(info.artist, info.album);
181+ if(res.empty())
182+ return DEFAULT_ALBUM_ART;
183+ return res;
181184 } catch(...) {
182− delete []buf;
183− throw;
184185 }
185− delete []buf;
186− return cache.get_art_file(info.artist, info.album);
186+ return DEFAULT_ALBUM_ART;
187187}
188188
189189QImage AlbumArtProvider::requestImage(const QString &id, QSize *realSize, const QSize &requestedSize) {