summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/graphics
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-04-20 14:06:35 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-04-21 15:12:52 +0000
commit031e0f436404a08a10aad330aaf1b271e5cdc2e9 (patch)
tree96213ba8f05ab3d8aa390253f51e70d6971304d5 /src/platformsupport/graphics
parent4a46a7cf500482b2203d1b8088acd0bb759fa60a (diff)
macOS: Fix crash when closing windows with raster backingstore
After 5b78fcd03b6 the raster backingstore tries to use the platform window to resolve the native DPR, but we might not always have a platform window. Instead we go though the window, like before, which has fallback paths for the case of no platform window, and then remove the Qt scaling factor manually. Change-Id: I19c8383b0a33f3d97aaf0d0e886ed03e14cb1592 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/platformsupport/graphics')
-rw-r--r--src/platformsupport/graphics/qrasterbackingstore.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp
index 2f7074403c..b8d393844c 100644
--- a/src/platformsupport/graphics/qrasterbackingstore.cpp
+++ b/src/platformsupport/graphics/qrasterbackingstore.cpp
@@ -60,7 +60,10 @@ void QRasterBackingStore::resize(const QSize &size, const QRegion &staticContent
{
Q_UNUSED(staticContents);
- qreal nativeWindowDevicePixelRatio = window()->handle()->devicePixelRatio();
+ // We can't guarantee that we have a platform-window at this point, so we have
+ // to pull out the DPR using QWindow and its QScreen fallback, and then remove
+ // the Qt scaling factor.
+ qreal nativeWindowDevicePixelRatio = window()->devicePixelRatio() / QHighDpiScaling::factor(window());
QSize effectiveBufferSize = size * nativeWindowDevicePixelRatio;
if (m_image.size() == effectiveBufferSize)