summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-04-22 10:05:08 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-04-22 10:12:26 (GMT)
commite8468f21d24b85114a8841413f9328a17f7bc54d (patch)
treefa154d5902913c0393a88a13de7a1aabdc864309
parent5cba8ea7d6b793ba0012dfc387e6859ace7c664a (diff)
downloadQt-e8468f21d24b85114a8841413f9328a17f7bc54d.zip
Qt-e8468f21d24b85114a8841413f9328a17f7bc54d.tar.gz
Qt-e8468f21d24b85114a8841413f9328a17f7bc54d.tar.bz2
Fix crash in drawPixmap when painting on a null pixmap
We need to check if the engine is null before we do the thread test. Reviewed-by: Thiago
-rw-r--r--src/gui/painting/qpainter.cpp6
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index ffb273e..65d87fa 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5167,6 +5167,9 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm)
Q_D(QPainter);
+ if (!d->engine)
+ return;
+
#ifndef QT_NO_DEBUG
qt_painter_thread_test(d->device->devType(), "drawPixmap()");
#endif
@@ -5176,9 +5179,6 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm)
return;
}
- if (!d->engine)
- return;
-
qreal x = p.x();
qreal y = p.y();
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 8b43f9b..c81bf67 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -3792,8 +3792,11 @@ void tst_QPainter::imageBlending()
void tst_QPainter::paintOnNullPixmap()
{
+ QPixmap pix(16, 16);
+
QPixmap textPixmap;
QPainter p(&textPixmap);
+ p.drawPixmap(10, 10, pix);
p.end();
QPixmap textPixmap2(16,16);