Fixed assert during QQuickCanvas::hideEvent().
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>
Mon, 21 Nov 2011 13:02:45 +0000 (14:02 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 24 Nov 2011 11:46:14 +0000 (12:46 +0100)
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 <gunnar.sletta@nokia.com>
src/declarative/items/qquickcanvas.cpp
src/declarative/items/qquickcanvas.h

index c699a76..c6969b5 100644 (file)
@@ -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;
 }
index 83e3087..a480439 100644 (file)
@@ -139,7 +139,6 @@ protected:
 #endif
 
 private Q_SLOTS:
-    void sceneGraphChanged();
     void maybeUpdate();
     void animationStarted();
     void animationStopped();