summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorTor Arne Vestbø <torarnv@gmail.com>2019-05-09 18:20:16 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-05-11 12:01:40 +0000
commita9246c7132a2c8864d3ae6cebd260bb9ee711fcb (patch)
tree11e56ec40e0989274438317562352d099dbd23b0 /src/widgets
parent41aa78856e054ee0d770e375f127dbc18317fbeb (diff)
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>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidget.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 2c84ff7161..53d87c6113 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -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();