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 | |
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>
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 12 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop_p.h | 5 |
2 files changed, 9 insertions, 8 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; } diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h index 4a22fd60e7..8d5312b188 100644 --- a/src/quick/scenegraph/qsgrenderloop_p.h +++ b/src/quick/scenegraph/qsgrenderloop_p.h @@ -91,15 +91,14 @@ public: virtual bool interleaveIncubation() const { return false; } + static void cleanup(); + Q_SIGNALS: void timeToIncubate(); protected: void handleContextCreationFailure(QQuickWindow *window, bool isEs); -public Q_SLOTS: - void cleanup(); - private: static QSGRenderLoop *s_instance; |