QPixmap: check data ptr in isQBitmap()

Task-number: QTBUG-51271
Change-Id: I670e074ced1217d2614fa334eb365e40ef80b8b1
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Anton Kudryavtsev 2016-02-20 15:48:40 +03:00
parent d8e65d5756
commit 9e59174b49
2 changed files with 10 additions and 1 deletions

View File

@ -481,7 +481,7 @@ QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)
bool QPixmap::isQBitmap() const
{
return data->type == QPlatformPixmap::BitmapType;
return data && data->type == QPlatformPixmap::BitmapType;
}
/*!

View File

@ -105,6 +105,7 @@ private slots:
void drawBitmap();
void isNull();
void task_246446();
void task_51271();
void convertFromImageNoDetach();
void convertFromImageDetach();
@ -1441,6 +1442,14 @@ void tst_QPixmap::task_246446()
QVERIFY(pm.mask().isNull());
}
void tst_QPixmap::task_51271()
{
QPixmap pm;
QBitmap bm;
QVERIFY(!pm.isQBitmap()); // Should not crash !
QVERIFY(bm.isQBitmap());
}
void tst_QPixmap::preserveDepth()
{
QPixmap target(64, 64);