summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2014-09-12 16:55:49 +0200
committerSean Harmer <sean.harmer@kdab.com>2014-09-29 13:53:05 +0200
commit3b35708c2ae6377e89496402c06c240fd5945a19 (patch)
tree794f860ca57d9a7ae6b8e5f677a851f29b90bf08
parent8fd4ff0fbeb95a5a50b97af05288eb7ba5febb2b (diff)
downloadqt3d-3b35708c2ae6377e89496402c06c240fd5945a19.tar.gz
RenderTarget and manager cleanup methods
Change-Id: I4c46a13d87516401f338690d287dd3d502ab84b1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/render/backend/rendertarget.cpp6
-rw-r--r--src/render/backend/rendertarget_p.h1
-rw-r--r--src/render/backend/rendertargetmanager_p.h2
3 files changed, 9 insertions, 0 deletions
diff --git a/src/render/backend/rendertarget.cpp b/src/render/backend/rendertarget.cpp
index dca2e00b0..761a61b87 100644
--- a/src/render/backend/rendertarget.cpp
+++ b/src/render/backend/rendertarget.cpp
@@ -85,6 +85,12 @@ void RenderTarget::setRenderer(Renderer *renderer)
m_renderer = renderer;
}
+void RenderTarget::cleanup()
+{
+ if (m_renderer != Q_NULLPTR && !m_renderTargetUuid.isNull())
+ m_renderer->rendererAspect()->aspectManager()->changeArbiter()->unregisterObserver(this, m_renderTargetUuid);
+}
+
void RenderTarget::appendRenderAttachment(QRenderAttachment *attachment)
{
if (!m_renderAttachments.contains(attachment->uuid()))
diff --git a/src/render/backend/rendertarget_p.h b/src/render/backend/rendertarget_p.h
index f5e870ea2..8afb880f0 100644
--- a/src/render/backend/rendertarget_p.h
+++ b/src/render/backend/rendertarget_p.h
@@ -65,6 +65,7 @@ public:
void setPeer(QRenderTarget *peer);
void setRenderer(Renderer *renderer);
+ void cleanup();
void appendRenderAttachment(QRenderAttachment *attachment);
void removeRenderAttachment(const QUuid &attachmentId);
diff --git a/src/render/backend/rendertargetmanager_p.h b/src/render/backend/rendertargetmanager_p.h
index eeedc6ae6..74ad80d1b 100644
--- a/src/render/backend/rendertargetmanager_p.h
+++ b/src/render/backend/rendertargetmanager_p.h
@@ -66,6 +66,8 @@ public:
} // Render
+Q_DECLARE_RESOURCE_INFO(Render::RenderTarget, Q_REQUIRES_CLEANUP);
+
} // Qt3D
QT_END_NAMESPACE