summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-01-20 08:29:08 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2010-01-20 09:41:49 (GMT)
commit8721d060a67a01ac891cab9d3d17aacf7373bcf0 (patch)
treeea6158b84dd0f96de1c8fc2695f7a436e20daf7d /src
parent7127f5ba2cc5729cfa12f5705e2dcfdcb99e1b91 (diff)
downloadQt-8721d060a67a01ac891cab9d3d17aacf7373bcf0.zip
Qt-8721d060a67a01ac891cab9d3d17aacf7373bcf0.tar.gz
Qt-8721d060a67a01ac891cab9d3d17aacf7373bcf0.tar.bz2
Fixed QBitmap::load to load into bitmap format again.
Task: http://bugreports.qt.nokia.com/browse/QTBUG-7468 Reviewed-by: Trond
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qpixmap.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 7b522f5..5a43de7 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -833,14 +833,21 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
if (QPixmapCache::find(key, *this))
return true;
- QPixmapData *tmp = QPixmapData::create(0, 0, QPixmapData::PixmapType);
- if (tmp->fromFile(fileName, format, flags)) {
- data = tmp;
- QPixmapCache::insert(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();
}
- delete tmp;
- return false;
+
+ if (ok)
+ QPixmapCache::insert(key, *this);
+
+ return ok;
}
/*!