diff options
author | Romain Pokrzywka <romain.pokrzywka@bluescape.com> | 2020-03-25 00:46:15 -0500 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-05-04 11:09:04 +0000 |
commit | 002fe9ee421223de9ddf7f4ed63df1002d9e9c51 (patch) | |
tree | 38601bd452451d0aba87b7682e7f8d3b978a3bb7 | |
parent | 73a620559749cb636766ae7f94a32e0cc7cdb6e7 (diff) |
Avoid stale QSGTexture pointer accesses
On rare occasions, it seems to be possible for the texture to be used
after deletion, which results in crashes in pixmap() after casting.
Rather than storing a raw pointer, wrap the texture in QPointer to
avoid the stale pointer accesses.
Task-number: QTBUG-80415
Change-Id: Ia0ee556f4a3a4eee777ca14065635f4bc5f90da2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 1c010b202506bb7eb0f0e24ab37ad50e319abada)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode_p.h index cd39edc11b..8fe4b5916a 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode_p.h @@ -54,6 +54,8 @@ #include <private/qsgadaptationlayer_p.h> #include <private/qsgtexturematerial_p.h> +#include <QtCore/QPointer> + QT_BEGIN_NAMESPACE namespace QSGSoftwareHelpers { @@ -132,7 +134,7 @@ private: QRectF m_innerSourceRect; QRectF m_subSourceRect; - QSGTexture *m_texture; + QPointer<QSGTexture> m_texture; QPixmap m_cachedMirroredPixmap; bool m_mirror; |