aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@qt.io>2023-03-16 14:58:52 +0100
committerAndy Nichols <nezticle@gmail.com>2023-03-17 20:57:14 +0100
commit02e9a6b325095a06c1ab899ea151d6521ac5d7da (patch)
treebaefbd105b191b347efa293259eaebb8ad508957 /src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
parent55cb48493482c2254fe2d0a05015466b55e6002f (diff)
SceneGraph: Don't let QSGRenderNode::m_matrix be a dangling pointer
Previously QSGRenderNode::m_matrix would be a dangling pointer most of the time. We document it as being valid during both the prepare, and render methods, but it would only be valid during the prepare phase. This was solved with the projectionMatrix by keeping a local copy instead of a pointer. No code was actually using the dangling pointer, but as a preventive measure since we document matrix as being valid also during the rhiRender we now have a local copy in QSGRenderNodePrivate, and manually set the pointer reference for the API, as well as a note to fix this non-ideal situtation in Qt 7. Fixes: QTBUG-97589 Change-Id: Idc0617de579d3d4ce5cc590534445f609adb9d61 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp')
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
index e59f894d7f..79fa4a78ad 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
@@ -225,8 +225,8 @@ QRegion QSGSoftwareRenderableNode::renderNode(QPainter *painter, bool forceOpaqu
return QRegion();
} else {
QSGRenderNodePrivate *rd = QSGRenderNodePrivate::get(m_handle.renderNode);
- QMatrix4x4 m = m_transform;
- rd->m_matrix = &m;
+ rd->m_localMatrix = m_transform;
+ rd->m_matrix = &rd->m_localMatrix;
rd->m_opacity = m_opacity;
// all the clip region below is in world coordinates, taking m_transform into account already