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-04 09:53:57 +0000
commit4e7a9504584d73eb70fa3571ac05e426f31a2ff7 (patch)
treee9051f6b6160dca6ad70838654f08b4de2b01933
parent7a223759de11e728bf8db7241889785f155f7853 (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;