Fix a crash of accessing deleted paintengine

When painting to QPixmap with QBlitterPaintEngine and dfb
PaintEngine have PaintDevice (pdev) as QImage. Painter code
uses PaintDevice::paintEngine() to refer to paintEngine.
This will became dangling pointer since QDirectFbBlitter::doLock()
will delete QImage. Instead return QPixmap as PaintDevice.

Change-Id: Idfac919b6438a82b412020e441e0a102e4a2a052
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
Michal Klocek 2014-02-20 16:50:15 +01:00 committed by The Qt Project
parent 45f264b682
commit 72fe9f1d0d

View File

@ -494,11 +494,12 @@ void QBlitterPaintEngine::clipEnabledChanged()
bool QBlitterPaintEngine::begin(QPaintDevice *pdev) bool QBlitterPaintEngine::begin(QPaintDevice *pdev)
{ {
Q_D(QBlitterPaintEngine);
bool ok = QRasterPaintEngine::begin(pdev); bool ok = QRasterPaintEngine::begin(pdev);
#ifdef QT_BLITTER_RASTEROVERLAY #ifdef QT_BLITTER_RASTEROVERLAY
Q_D(QBlitterPaintEngine);
d->pmData->unmergeOverlay(); d->pmData->unmergeOverlay();
#endif #endif
d->pdev = pdev;
return ok; return ok;
} }