summaryrefslogtreecommitdiffstats
path: root/src/core/aspects/qaspectmanager.cpp
diff options
context:
space:
mode:
authorJim Albamont <jim.albamont@kdab.com>2019-09-17 17:04:43 -0700
committerJim Albamont <jim.albamont@kdab.com>2019-09-18 10:04:32 -0700
commit1cdf47f02e2b32da4ac82561f625716642d2933a (patch)
tree2be35e656bab5191ca643d326864eef8b55eddc3 /src/core/aspects/qaspectmanager.cpp
parent63717986fdd41e53f021eeed9c6a7d10062af530 (diff)
Process pending nodes needing _q_postConstructorInit at start of frame
NodePostConstructorInit::processNodes and QAspectManager::processFrame are both triggered by the event loop which means the frame can happen before the processNodes call. We want to ensure processNodes is called first so those pending nodes can be created during the processFrame call otherwise they will get deferred until the next frame. Created a test to show this and removed the now unnecessary double calls to processEvents in several other tests. Change-Id: I7a3f7b34be2858b4acdb9275804b458f9366ec67 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core/aspects/qaspectmanager.cpp')
-rw-r--r--src/core/aspects/qaspectmanager.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp
index 6bca77a9e..a33f771e9 100644
--- a/src/core/aspects/qaspectmanager.cpp
+++ b/src/core/aspects/qaspectmanager.cpp
@@ -374,6 +374,11 @@ QServiceLocator *QAspectManager::serviceLocator() const
return m_serviceLocator.data();
}
+void QAspectManager::setPostConstructorInit(NodePostConstructorInit *postConstructorInit)
+{
+ m_postConstructorInit = postConstructorInit;
+}
+
/*!
\internal
\brief Drives the Qt3D simulation loop in the main thread
@@ -429,6 +434,10 @@ void QAspectManager::processFrame()
changeArbiterStats.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
#endif
+ // Tell the NodePostConstructorInit to process any pending nodes which will add them to our list of
+ // tree changes
+ m_postConstructorInit->processNodes();
+
// Add and Remove Nodes
const QVector<NodeTreeChange> nodeTreeChanges = std::move(m_nodeTreeChanges);
for (const NodeTreeChange &change : nodeTreeChanges) {