summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-04-15 15:50:15 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-04-16 08:00:14 +0000
commit7c6b969383a403474a63715fd7a12caddd826611 (patch)
tree508ef5136e3bfc08d91ad0589453b2aab5f0608e /src/plugins/platforms/eglfs
parent5b3dfa470ed7ea40103daa785286ab71fb7aa230 (diff)
eglfs: Call destroy() from dtors of concrete windows
Calling destroy from the QEglFSWindow dtor() triggers the virtual invalidateSurface() to be called on a partly destroyed object. As the child windows deregister themselves from their screens on invalidateSurface() this is dangerous: It leaves a dangling pointer in the screen. Fixes: QTBUG-75075 Change-Id: Idd3fea18562d41973f364340df875a50dbd5691e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs')
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp3
4 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
index 98e9ee4728..c1d5af47aa 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
@@ -167,6 +167,9 @@ void QEglFSWindow::create()
void QEglFSWindow::destroy()
{
+ if (!m_flags.testFlag(Created))
+ return; // already destroyed
+
#ifndef QT_NO_OPENGL
QOpenGLCompositor::instance()->removeWindow(this);
#endif
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h
index a19cf7e8bc..ee4b7978f1 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h
@@ -55,6 +55,9 @@ public:
: QEglFSWindow(w),
m_integration(integration)
{ }
+
+ ~QEglFSKmsGbmWindow() { destroy(); }
+
void resetSurface() override;
void invalidateSurface() override;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
index ecdfb352ab..3e78196227 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
@@ -116,6 +116,8 @@ public:
, m_egl_stream(EGL_NO_STREAM_KHR)
{ }
+ ~QEglFSKmsEglDeviceWindow() { destroy(); }
+
void invalidateSurface() override;
void resetSurface() override;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp
index 0d9b6b6290..d1250ec9bf 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp
@@ -205,6 +205,9 @@ public:
: QEglFSWindow(w)
, m_integration(integration)
{}
+
+ ~QEglFSKmsVsp2Window() { destroy(); }
+
void resetSurface() override;
void invalidateSurface() override;
const QEglFSKmsVsp2Integration *m_integration;