diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-11-07 11:00:07 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-11-07 12:26:09 +0000 |
commit | cfbb0d2b407e45d652d18ecd940adbbc8b3ddddd (patch) | |
tree | 724d694a4327ec8d766b1865fece791286ee3fa5 /src | |
parent | 6d255b467becad5b5ffebbfa1d13e16b2dd20a64 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 8c680560d4..da0d530990 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -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); |