diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-03-28 13:52:26 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-29 07:35:29 +0100 |
commit | c19962a142c529998ff7c6261fa098f33c646c3d (patch) | |
tree | 56c31b439c57d148384ce10a14e4e943f6ce9b93 /src/quick/scenegraph/qsgrenderloop.cpp | |
parent | 8b371173c4fed7df453a0e352af54e3363709d4b (diff) |
Destroy render loop when QCoreApplication is cleaned up.
Doing it on 'aboutToQuit' meant we would clean it up whenever an
application ran QCoreApp::exec() which could be multiple times
per application run.
Change-Id: I59e06398a551ae7979e3832dff811937037fa106
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/quick/scenegraph/qsgrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index d267fb086d..2ef84980a3 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -89,15 +89,17 @@ QSGRenderLoop::~QSGRenderLoop() void QSGRenderLoop::cleanup() { - foreach (QQuickWindow *w, windows()) { + if (!s_instance) + return; + foreach (QQuickWindow *w, s_instance->windows()) { QQuickWindowPrivate *wd = QQuickWindowPrivate::get(w); - if (wd->windowManager == this) { - windowDestroyed(w); + if (wd->windowManager == s_instance) { + s_instance->windowDestroyed(w); wd->windowManager = 0; } } + delete s_instance; s_instance = 0; - delete this; } class QSGGuiThreadRenderLoop : public QSGRenderLoop @@ -216,7 +218,7 @@ QSGRenderLoop *QSGRenderLoop::instance() } } - QObject::connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), s_instance, SLOT(cleanup())); + qAddPostRoutine(QSGRenderLoop::cleanup); } return s_instance; } |