Fix: confusion in QImage paintEngine creation on shared images
During the creation of a raster paint engine in QImage::paintEngine(), the QImage will be detached. At least old gcc versions would get confused so that the newly created paintengine would end up in the old QImage copy insteads of the newly detached one. Work around by dropping the temporary engine pointer. Fixes: QTBUG-79383 Change-Id: I27b1f24312269bc2bcc641dc4334397a92e3bfbb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>bb10
parent
aa4b0f5cb7
commit
03717be788
|
|
@ -4145,11 +4145,11 @@ QPaintEngine *QImage::paintEngine() const
|
|||
|
||||
if (!d->paintEngine) {
|
||||
QPaintDevice *paintDevice = const_cast<QImage *>(this);
|
||||
QPaintEngine *paintEngine = 0;
|
||||
QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
|
||||
if (platformIntegration)
|
||||
paintEngine = platformIntegration->createImagePaintEngine(paintDevice);
|
||||
d->paintEngine = paintEngine ? paintEngine : new QRasterPaintEngine(paintDevice);
|
||||
d->paintEngine = platformIntegration->createImagePaintEngine(paintDevice);
|
||||
if (!d->paintEngine)
|
||||
d->paintEngine = new QRasterPaintEngine(paintDevice);
|
||||
}
|
||||
|
||||
return d->paintEngine;
|
||||
|
|
|
|||
|
|
@ -2132,6 +2132,12 @@ void tst_QImage::paintEngine()
|
|||
|
||||
QCOMPARE(engine, img.paintEngine());
|
||||
QCOMPARE(img, expected);
|
||||
|
||||
{
|
||||
QImage img1(16, 16, QImage::Format_ARGB32);
|
||||
QImage img2 = img1;
|
||||
QVERIFY(img2.paintEngine());
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QImage::setAlphaChannelWhilePainting()
|
||||
|
|
|
|||
Loading…
Reference in New Issue