1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-31 03:27:40 +01:00

Make a scoped pointer from the thing retreived from the moodbar cache

This commit is contained in:
David Sansome 2012-05-25 18:04:52 +01:00
parent 51229b88c5
commit f98d5e8fb6

View File

@ -25,6 +25,8 @@
#include <QNetworkDiskCache> #include <QNetworkDiskCache>
#include <QUrl> #include <QUrl>
#include <boost/scoped_ptr.hpp>
MoodbarLoader::MoodbarLoader(QObject* parent) MoodbarLoader::MoodbarLoader(QObject* parent)
: QObject(parent), : QObject(parent),
cache_(new QNetworkDiskCache(this)) cache_(new QNetworkDiskCache(this))
@ -72,11 +74,10 @@ MoodbarLoader::Result MoodbarLoader::Load(
} }
// Maybe it exists in the cache? // Maybe it exists in the cache?
QIODevice* cache_device = cache_->data(url); boost::scoped_ptr<QIODevice> cache_device(cache_->data(url));
if (cache_device) { if (cache_device) {
qLog(Info) << "Loading cached moodbar data for" << filename; qLog(Info) << "Loading cached moodbar data for" << filename;
*data = cache_device->readAll(); *data = cache_device->readAll();
delete cache_device;
return Loaded; return Loaded;
} }