aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Pokrzywka <romain.pokrzywka@bluescape.com>2020-03-25 00:46:15 -0500
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-05-05 07:57:01 +0000
commitfd469b45100074e44e8bfb57e732b25a29dc2acd (patch)
tree4a5c0018ef97237efc3f71a7ea84db553aec6f83
parentdefe68463230b454d3ddfb039ca423c01cddab91 (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.h4
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 b80bacbaa0..af912e1a3f 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;