diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-04-20 14:06:35 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-04-21 15:12:52 +0000 |
commit | 031e0f436404a08a10aad330aaf1b271e5cdc2e9 (patch) | |
tree | 96213ba8f05ab3d8aa390253f51e70d6971304d5 /src/platformsupport | |
parent | 4a46a7cf500482b2203d1b8088acd0bb759fa60a (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')
-rw-r--r-- | src/platformsupport/graphics/qrasterbackingstore.cpp | 5 |
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) |