summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-10-15 17:01:06 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-10-17 12:04:16 +0200
commit92f29f8592f4067a07e57f81f8cde44df55c0756 (patch)
treecfea36bf8da0022f204c9d638c6f018421ad0b20
parentaee3dbc8b8f90b76d18ccc833b36dfb787c0bdc5 (diff)
FrameGraphNode: mark dirty on cleanup
Otherwise the FG cache is not rebuilt and we might have dangling pointers around. Change-Id: Id97de41092617acbf067fcac4cf7805c2eb715da Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r--src/render/framegraph/framegraphnode.cpp1
-rw-r--r--tests/auto/render/framegraphnode/tst_framegraphnode.cpp18
2 files changed, 19 insertions, 0 deletions
diff --git a/src/render/framegraph/framegraphnode.cpp b/src/render/framegraph/framegraphnode.cpp
index 58ff05dc0..40d8fca3d 100644
--- a/src/render/framegraph/framegraphnode.cpp
+++ b/src/render/framegraph/framegraphnode.cpp
@@ -123,6 +123,7 @@ QVector<FrameGraphNode *> FrameGraphNode::children() const
void FrameGraphNode::cleanup()
{
setParentId({});
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
void FrameGraphNode::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
diff --git a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
index 770f7e72d..a7cea2ef2 100644
--- a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
+++ b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
@@ -266,6 +266,24 @@ private Q_SLOTS:
}
}
+ void checCleanupMarksDirty()
+ {
+ // GIVEN
+ TestRenderer renderer;
+ Qt3DRender::Render::FrameGraphNode *backendFGNode = new MyFrameGraphNode();
+
+ backendFGNode->setRenderer(&renderer);
+
+ // THEN
+ QVERIFY(renderer.dirtyBits() == 0);
+
+ // WHEN
+ backendFGNode->cleanup();
+
+ // THEN
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ }
+
};
QTEST_MAIN(tst_FrameGraphNode)