From: Gunnar Sletta Date: Tue, 21 Feb 2012 06:23:42 +0000 (+0100) Subject: Release resources on shutdown.. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=ef6318ae38322b5a4a0619b581924290f114fa74;p=konrad%2Fqtdeclarative.git Release resources on shutdown.. Change-Id: I7758f5ba1f58e19d92e394133cccd449ce5a1756 Reviewed-by: Samuel Rødal --- diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp index 61962bb..b999e6f 100644 --- a/src/quick/items/qquickwindowmanager.cpp +++ b/src/quick/items/qquickwindowmanager.cpp @@ -176,6 +176,11 @@ public: connect(animationDriver, SIGNAL(stopped()), this, SLOT(animationStopped())); } + ~QQuickRenderThreadSingleContextWindowManager() + { + releaseResources(); + } + QSGContext *sceneGraphContext() const { return sg; } void show(QQuickCanvas *canvas); @@ -286,6 +291,10 @@ class QQuickTrivialWindowManager : public QObject, public QQuickWindowManager { public: QQuickTrivialWindowManager(); + ~QQuickTrivialWindowManager() + { + releaseResources(); + } void show(QQuickCanvas *canvas); void hide(QQuickCanvas *canvas); @@ -786,7 +795,6 @@ void QQuickRenderThreadSingleContextWindowManager::releaseResourcesInThread() #ifdef THREAD_DEBUG printf(" RenderThread: releasing resources...\n"); #endif - QQuickCanvas *canvas = masterCanvas(); QWindow *tmpSurface = 0; @@ -822,7 +830,7 @@ void QQuickRenderThreadSingleContextWindowManager::releaseResources() runToReleaseResources = true; start(); - while (gl) { + while (isRunning()) { wait(); } } @@ -1217,7 +1225,7 @@ void QQuickTrivialWindowManager::canvasDestroyed(QQuickCanvas *canvas) void QQuickTrivialWindowManager::releaseResources() { - if (m_windows.size() == 0) { + if (m_windows.size() == 0 && gl) { QQuickCanvas *canvas = masterCanvas(); QWindow *tmpSurface = 0;