Reset QWidget's winId when backing window surface is destroyed
We already reset it though e.g. QWidget::destroy, but if the backing window is destroyed spontaneously or via another API we need to catch that and send a WinIdChange event so clients who pulled out the original winId will not think the pointer is still valid Change-Id: I8556940ee871e81a51f73daeb2064f95bf41371c Fixes: QTBUG-69289 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
41aa78856e
commit
a9246c7132
@ -9365,6 +9365,12 @@ bool QWidget::event(QEvent *event)
|
||||
d->renderToTextureReallyDirty = 1;
|
||||
#endif
|
||||
break;
|
||||
case QEvent::PlatformSurface: {
|
||||
auto surfaceEvent = static_cast<QPlatformSurfaceEvent*>(event);
|
||||
if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed)
|
||||
d->setWinId(0);
|
||||
break;
|
||||
}
|
||||
#ifndef QT_NO_PROPERTIES
|
||||
case QEvent::DynamicPropertyChange: {
|
||||
const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
|
||||
|
Loading…
x
Reference in New Issue
Block a user