Skip to content

Commit

Permalink
Release resources on shutdown..
Browse files Browse the repository at this point in the history
Change-Id: I7758f5ba1f58e19d92e394133cccd449ce5a1756
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
  • Loading branch information
Gunnar Sletta authored and Qt by Nokia committed Feb 21, 2012
1 parent b672f19 commit ef6318a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/quick/items/qquickwindowmanager.cpp
Expand Up @@ -176,6 +176,11 @@ class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQui
connect(animationDriver, SIGNAL(stopped()), this, SLOT(animationStopped()));
}

~QQuickRenderThreadSingleContextWindowManager()
{
releaseResources();
}

QSGContext *sceneGraphContext() const { return sg; }

void show(QQuickCanvas *canvas);
Expand Down Expand Up @@ -286,6 +291,10 @@ class QQuickTrivialWindowManager : public QObject, public QQuickWindowManager
{
public:
QQuickTrivialWindowManager();
~QQuickTrivialWindowManager()
{
releaseResources();
}

void show(QQuickCanvas *canvas);
void hide(QQuickCanvas *canvas);
Expand Down Expand Up @@ -786,7 +795,6 @@ void QQuickRenderThreadSingleContextWindowManager::releaseResourcesInThread()
#ifdef THREAD_DEBUG
printf(" RenderThread: releasing resources...\n");
#endif

QQuickCanvas *canvas = masterCanvas();
QWindow *tmpSurface = 0;

Expand Down Expand Up @@ -822,7 +830,7 @@ void QQuickRenderThreadSingleContextWindowManager::releaseResources()
runToReleaseResources = true;
start();

while (gl) {
while (isRunning()) {
wait();
}
}
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ef6318a

Please sign in to comment.