diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-11-09 12:35:02 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-09 15:18:09 +0100 |
commit | 39b7c020a38a2a0dadc72c2f841fdb8f322f8588 (patch) | |
tree | 538143b0e3ed4e48924d16e2405b3e8d01fdd4d2 /src/declarative/items/qquickcanvas.cpp | |
parent | 59495d2ceeb50da7329b0b13c8f4154aeeb99c0d (diff) |
Delete nodes in the render thread at shutdown
This fixes a crash on OS X and possibly other platforms.
Change-Id: Ie8fc451b526d12d46133ef560c04e88c0b142b9a
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
Diffstat (limited to 'src/declarative/items/qquickcanvas.cpp')
-rw-r--r-- | src/declarative/items/qquickcanvas.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/declarative/items/qquickcanvas.cpp b/src/declarative/items/qquickcanvas.cpp index 86d44db4c9..2f6821b3e1 100644 --- a/src/declarative/items/qquickcanvas.cpp +++ b/src/declarative/items/qquickcanvas.cpp @@ -1633,6 +1633,30 @@ void QQuickCanvasPrivate::cleanupNodes() cleanupNodeList.clear(); } +void QQuickCanvasPrivate::cleanupNodesOnShutdown(QQuickItem *item) +{ + QQuickItemPrivate *p = QQuickItemPrivate::get(item); + if (p->itemNodeInstance) { + delete p->itemNodeInstance; + p->itemNodeInstance = 0; + p->opacityNode = 0; + p->clipNode = 0; + p->groupNode = 0; + p->paintNode = 0; + } + + for (int ii = 0; ii < p->childItems.count(); ++ii) + cleanupNodesOnShutdown(p->childItems.at(ii)); +} + +// This must be called from the render thread, with the main thread frozen +void QQuickCanvasPrivate::cleanupNodesOnShutdown() +{ + cleanupNodes(); + + cleanupNodesOnShutdown(rootItem); +} + void QQuickCanvasPrivate::updateDirtyNodes() { #ifdef DIRTY_DEBUG @@ -2137,6 +2161,11 @@ void QQuickCanvasRenderThread::run() } #ifdef THREAD_DEBUG + printf(" RenderThread: deleting all outstanding nodes\n"); +#endif + cleanupNodesOnShutdown(); + +#ifdef THREAD_DEBUG printf(" RenderThread: render loop exited... Good Night!\n"); #endif |