From 92f29f8592f4067a07e57f81f8cde44df55c0756 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 15 Oct 2019 17:01:06 +0200 Subject: 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 --- src/render/framegraph/framegraphnode.cpp | 1 + .../auto/render/framegraphnode/tst_framegraphnode.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) 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::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) -- cgit v1.2.3