diff options
author | Aurélien Brooke <aurelien@bahiasoft.fr> | 2023-03-21 12:57:01 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-04-13 12:14:22 +0000 |
commit | 3b24faf00f229a21ebd77d3241b51f2fdeb65279 (patch) | |
tree | 0f56de42a4219c77f62a8ae6a51bb5dfd333d9a0 | |
parent | 15b2874a26119e971bd78e1db04024742b499dc2 (diff) | |
download | qt3d-3b24faf00f229a21ebd77d3241b51f2fdeb65279.tar.gz |
PlatformSurfaceFilter: fix crash when Scene3D is destroyed after window
When closing a window containing a Scene3D, the aspect engine is
destroyed after the QWindow (because of delete later), so the m_obj
pointer we store inside the PlatformSurfaceFilter becomes dangling,
leading to a crash in the destructor.
Use QPointer to ensure m_obj it set null when it is destroyed.
Fixes: QTBUG-111325
Change-Id: Icf153700a5708abff4b92b14ce2f9bb12d8653eb
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit 2c3ebe01cb2875bfe48af20446b8c2b62ff49382)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/render/backend/platformsurfacefilter_p.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/render/backend/platformsurfacefilter_p.h b/src/render/backend/platformsurfacefilter_p.h index 7074850d9..1a4c42c81 100644 --- a/src/render/backend/platformsurfacefilter_p.h +++ b/src/render/backend/platformsurfacefilter_p.h @@ -18,6 +18,7 @@ #include <private/qt3drender_global_p.h> #include <QtCore/qobject.h> +#include <QtCore/qpointer.h> #include <QtGui/qsurface.h> #include <QSemaphore> @@ -64,7 +65,7 @@ public: } } private: - QObject *m_obj; + QPointer<QObject> m_obj; QSurface *m_surface; static QSemaphore m_surfacesSemaphore; |