From b7be92e8ad22481c79f87e3741f85609c2612be7 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 21 Nov 2011 14:02:45 +0100 Subject: [PATCH] Fixed assert during QQuickCanvas::hideEvent(). Also fixed a memory leak in the non-threaded renderer so that it is on par with the threaded one. Change-Id: Ie3111730a9d10085c83f7aafceda240419b722cd Reviewed-by: Gunnar Sletta --- src/declarative/items/qquickcanvas.cpp | 20 +++----------------- src/declarative/items/qquickcanvas.h | 1 - 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/declarative/items/qquickcanvas.cpp b/src/declarative/items/qquickcanvas.cpp index c699a76..c6969b5 100644 --- a/src/declarative/items/qquickcanvas.cpp +++ b/src/declarative/items/qquickcanvas.cpp @@ -166,7 +166,9 @@ public: maybeUpdate(); } - virtual void stopRendering() { } + virtual void stopRendering() { + cleanupNodesOnShutdown(); + } virtual void maybeUpdate() { if (!updatePending) { @@ -407,8 +409,6 @@ void QQuickCanvasPrivate::initializeSceneGraph() context->initialize(glctx); Q_Q(QQuickCanvas); - QObject::connect(context->renderer(), SIGNAL(sceneGraphChanged()), q, SLOT(maybeUpdate()), - Qt::DirectConnection); if (!QQuickItemPrivate::get(rootItem)->itemNode()->parent()) { context->rootNode()->appendChildNode(QQuickItemPrivate::get(rootItem)->itemNode()); @@ -469,13 +469,6 @@ void QQuickCanvasPrivate::renderSceneGraph(const QSize &size) } -// ### Do we need this? -void QQuickCanvas::sceneGraphChanged() -{ -// Q_D(QQuickCanvas); -// d->needsRepaint = true; -} - QQuickCanvasPrivate::QQuickCanvasPrivate() : rootItem(0) , activeFocusItem(0) @@ -852,12 +845,6 @@ QQuickCanvas::~QQuickCanvas() { Q_D(QQuickCanvas); - /* The threaded renderer will clean up the nodes which will fire - sceneGraphChanged events through back to the canvas. This signal - is connected to maybeUpdate which should only be called from GUI or during - updatePaintNode(), so disconnect them before starting the shutdown - */ - disconnect(d->context->renderer(), SIGNAL(sceneGraphChanged()), this, SLOT(maybeUpdate())); if (d->thread->isRunning()) d->thread->stopRendering(); @@ -869,7 +856,6 @@ QQuickCanvas::~QQuickCanvas() delete d->incubationController; d->incubationController = 0; delete d->rootItem; d->rootItem = 0; - d->cleanupNodes(); delete d->thread; d->thread = 0; } diff --git a/src/declarative/items/qquickcanvas.h b/src/declarative/items/qquickcanvas.h index 83e3087..a480439 100644 --- a/src/declarative/items/qquickcanvas.h +++ b/src/declarative/items/qquickcanvas.h @@ -139,7 +139,6 @@ protected: #endif private Q_SLOTS: - void sceneGraphChanged(); void maybeUpdate(); void animationStarted(); void animationStopped(); -- 2.7.4