summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-25 13:33:00 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-27 10:53:32 +0000
commitd04207342ea4d22e42257eb0adc1048fd2e068b4 (patch)
tree2fec6f36766291a66f7c0760b1aeb99a02b91b34 /src
parent8e79806d08ab77aa0f87b69a2ef65789216f41c0 (diff)
macOS: Fix crash in QCocoaBackingStore::format() after closing window
Closing a window results in sending an expose event to obscure the window, which gets delivered after the corresponding QPlatformWindow has been destroyed. If the client application (wrongly) tries to render as a result of this expose event, using the existing QBackingStore, it will potentially result in a resize of the backing store, for example if the global device pixel ratio is different from what the window had when it still had a QPlatformWindow. The resize in turn requires the format() of the window, but since we no longer have a QPlatformWindow we can't base the format on that. Change-Id: Ied6a3a745f20087c2287ad86e1c66808467b6183 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index a74995319b..1d7ad772dc 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -57,7 +57,8 @@ QCocoaBackingStore::~QCocoaBackingStore()
QImage::Format QCocoaBackingStore::format() const
{
- if (static_cast<QCocoaWindow *>(window()->handle())->m_drawContentBorderGradient)
+ QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
+ if (cocoaWindow && cocoaWindow->m_drawContentBorderGradient)
return QImage::Format_ARGB32_Premultiplied;
return QRasterBackingStore::format();