Avoid crashing with opaque opacity effect

Fixes the crash, but doesn't fix the underlying bug.

Task-number: QTBUG-60231
Change-Id: I5db9b151089b5c0e21e21443c77c725804d3059c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2018-11-07 11:00:07 +01:00
parent 6d255b467b
commit cfbb0d2b40

View File

@ -5858,7 +5858,11 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *
pixmapOffset -= effectRect.topLeft();
const qreal dpr = context->painter->device()->devicePixelRatioF();
qreal dpr(1.0);
if (const auto *paintDevice = context->painter->device())
dpr = paintDevice->devicePixelRatioF();
else
qWarning("QWidgetEffectSourcePrivate::pixmap: Painter not active");
QPixmap pixmap(effectRect.size() * dpr);
pixmap.setDevicePixelRatio(dpr);