diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2016-05-17 18:23:20 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-05-20 18:18:25 +0000 |
commit | 9ffb65683ae756697bfc98490d25c71e66fc77f8 (patch) | |
tree | 046222ab193623fc0ff5ebfb0bfb7b018afd8960 /src/core/aspects/qaspectengine_p.h | |
parent | 0edb64686801d7ad3b9c245e8c6d7058718c84c3 (diff) |
Allow the QtQuick + Scene3D case to shutdown cleanly
...by having the Scene3D item exit the simulation loop before asking
the renderer to shutdown. This is necessary because if we let the
simulation loop keep running then the render aspect keeps creating and
executing jobs as we pull the rug out form under it by shutting down
the renderer. This exhibited quite regularly as a crash caused by a
race in the Shader::cleanup() function which tried to access the
GraphicsContext that was destroyed by the renderer shutdown.
This approach sequences things very similarly to the pure Qt 3D shutdown
method. The main difference is that we explicitly stop the simulation
loop whereas in the pure Qt 3D case, that is done for us by the
QAspectEngine::setRootEntity(null) call. This is still done in the
QAspectEngine dtor but by that time, the simulation loop is already
stopped. The exit simulation logic has been adapted to handle this
case.
Task-number: QTBUG-51035
Task-number: QTBUG-42353
Change-Id: I08d16e301eab421fa6eb99e558f38e832534c151
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Diffstat (limited to 'src/core/aspects/qaspectengine_p.h')
-rw-r--r-- | src/core/aspects/qaspectengine_p.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/aspects/qaspectengine_p.h b/src/core/aspects/qaspectengine_p.h index 8ab604f58..c74e6dfbb 100644 --- a/src/core/aspects/qaspectengine_p.h +++ b/src/core/aspects/qaspectengine_p.h @@ -67,7 +67,7 @@ class QAspectThread; class QPostman; class QScene; -class QAspectEnginePrivate : public QObjectPrivate +class QT3DCORE_PRIVATE_EXPORT QAspectEnginePrivate : public QObjectPrivate { public: QAspectEnginePrivate(); @@ -87,12 +87,16 @@ public: void initialize(); void shutdown(); + void exitSimulationLoop(); + void initNodeTree(QNode *node); void initNode(QNode *node); void initEntity(QEntity *entity); void generateCreationChanges(QNode *rootNode); QVector<QNodeCreatedChangeBasePtr> m_creationChanges; + + static QAspectEnginePrivate *get(QAspectEngine *engine); }; } // Qt3D |