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>bb10
parent
8e79806d08
commit
d04207342e
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue