diff options
author | Trond Kjernåsen <trond@trolltech.com> | 2010-03-01 12:44:22 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond@trolltech.com> | 2010-03-01 12:47:25 (GMT) |
commit | 1ab5feb6260589f254ed209816cb67dbe9d3e4a5 (patch) | |
tree | 8deb32edf0cbe39db8b2fac9f692ba6a7e3143e0 /src/gui | |
parent | 334ed757857d14e075630644495540fb70a3aaae (diff) | |
download | Qt-1ab5feb6260589f254ed209816cb67dbe9d3e4a5.zip Qt-1ab5feb6260589f254ed209816cb67dbe9d3e4a5.tar.gz Qt-1ab5feb6260589f254ed209816cb67dbe9d3e4a5.tar.bz2 |
Fixed QPixmap::load() to not modify referenced copies (again!)
Change 8721d060a67a01ac891cab9d3d17aacf7373bcf0 broke the previous
fix.
Task-number: QTBUG-8606
Reviewed-by: Gunnar
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 08003e5..7b225eb 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -831,21 +831,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers if (QPixmapCache::find(key, *this)) return true; - bool ok; - - if (data) { - ok = data->fromFile(fileName, format, flags); - } else { - QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, QPixmapData::PixmapType)); - ok = tmp->fromFile(fileName, format, flags); - if (ok) - data = tmp.take(); - } - - if (ok) + QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, data ? data->type : QPixmapData::PixmapType)); + if (tmp->fromFile(fileName, format, flags)) { + data = tmp.take(); QPixmapCache::insert(key, *this); + return true; + } - return ok; + return false; } /*! |