diff options
author | Mike Krus <mike.krus@kdab.com> | 2019-10-23 07:19:49 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2019-10-28 17:47:13 +0000 |
commit | e5723fd820f5ae2c103c8985ea2d5d27d9bb7ee4 (patch) | |
tree | 03130379c8ea16e100d94f07c24b89e7853c59ac /src/core | |
parent | 1597b809a90138afc81fabbe96ffe2be98abc9de (diff) |
Fix frame advance service
on macOS, blocking the main thread waiting for current frame to finish
can lead to events flooding the event queue. In particular, moving the
mouse over the window causes the QBasicTimer used by the uniform
timer that drives (qtquick) animations to no longer fire.
Use tryAcquire to get the resources, waiting a short while to avoid
busy main thread.
Task-number: QTBUG-79379
Change-Id: I930aa8ad7d5a15600d7ac7af93e6e72321457089
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/aspects/qaspectmanager.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp index dffdd1c1a..f24248399 100644 --- a/src/core/aspects/qaspectmanager.cpp +++ b/src/core/aspects/qaspectmanager.cpp @@ -414,6 +414,8 @@ bool QAspectManager::event(QEvent *e) // the loop if (m_simulationLoopRunning && m_driveMode == QAspectEngine::Automatic) requestNextFrame(); + + return true; } return QObject::event(e); @@ -424,7 +426,7 @@ void QAspectManager::requestNextFrame() qCDebug(Aspects) << "Requesting new Frame"; // Post event in the event loop to force // next frame to be processed - qApp->postEvent(this, new RequestFrameEvent()); + QCoreApplication::postEvent(this, new RequestFrameEvent()); } void QAspectManager::processFrame() @@ -436,6 +438,8 @@ void QAspectManager::processFrame() m_serviceLocator->service<QAbstractFrameAdvanceService>(QServiceLocator::FrameAdvanceService); const qint64 t = frameAdvanceService->waitForNextFrame(); + if (t < 0) + return; // Distribute accumulated changes. This includes changes sent from the frontend // to the backend nodes. We call this before the call to m_scheduler->update() to ensure |