QRasterPlatformPixmap::createPixmapForImage(): Avoid crash when QImage conversion failes
Added some checks to QRasterPlatformPixmap::createPixmapForImage() to avoid crashes when QImage::convertToFormat() returns a null image. Change-Id: I573505a1aff7931d9a2fb452d0a83ae93d8de7db Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
4038f21dd0
commit
c92ece4518
@ -363,10 +363,12 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
|
|||||||
}
|
}
|
||||||
is_null = (w <= 0 || h <= 0);
|
is_null = (w <= 0 || h <= 0);
|
||||||
|
|
||||||
image.d->devicePixelRatio = sourceImage.devicePixelRatio();
|
if (image.d)
|
||||||
|
image.d->devicePixelRatio = sourceImage.devicePixelRatio();
|
||||||
//ensure the pixmap and the image resulting from toImage() have the same cacheKey();
|
//ensure the pixmap and the image resulting from toImage() have the same cacheKey();
|
||||||
setSerialNumber(image.cacheKey() >> 32);
|
setSerialNumber(image.cacheKey() >> 32);
|
||||||
setDetachNumber(image.d->detach_no);
|
if (image.d)
|
||||||
|
setDetachNumber(image.d->detach_no);
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage* QRasterPlatformPixmap::buffer()
|
QImage* QRasterPlatformPixmap::buffer()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user